From e271be083c2b7a542d282c52df41cd307c8e136f Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Tue, 26 Aug 2014 17:09:17 -0500 Subject: [svn-r25555] - rework the public H5VL wrappers to not use H5VL_t* and use a plugin hid_t instead - rework the private VL layer to use the class structure directly - some bug fixes --- examples/h5_vol_external_log_native.c | 57 +-- src/H5A.c | 96 ++-- src/H5Adeprec.c | 32 +- src/H5Aint.c | 14 - src/H5D.c | 54 ++- src/H5Ddeprec.c | 16 +- src/H5Dint.c | 2 +- src/H5Dio.c | 4 +- src/H5Dpkg.h | 2 +- src/H5F.c | 114 +++-- src/H5Fint.c | 4 +- src/H5Fmount.c | 4 +- src/H5G.c | 44 +- src/H5Gdeprec.c | 40 +- src/H5I.c | 15 +- src/H5L.c | 34 +- src/H5Lexternal.c | 2 +- src/H5O.c | 32 +- src/H5Ocopy.c | 4 +- src/H5R.c | 10 +- src/H5Rdeprec.c | 4 +- src/H5Tcommit.c | 37 +- src/H5Tdeprec.c | 10 +- src/H5Tprivate.h | 1 - src/H5VL.c | 848 +++++++++++++++++++++------------- src/H5VLint.c | 484 +++++++++---------- src/H5VLnative.c | 38 +- src/H5VLprivate.h | 122 ++--- src/H5VLpublic.h | 128 +++-- tools/misc/repart_test.c | 1 + 30 files changed, 1218 insertions(+), 1035 deletions(-) diff --git a/examples/h5_vol_external_log_native.c b/examples/h5_vol_external_log_native.c index d563441..5cc2593 100644 --- a/examples/h5_vol_external_log_native.c +++ b/examples/h5_vol_external_log_native.c @@ -40,6 +40,8 @@ static herr_t H5VL_log_group_close(void *grp, hid_t dxpl_id, void **req); static void *H5VL_log_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); static herr_t H5VL_log_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +hid_t native_plugin_id = -1; + static const H5VL_class_t H5VL_log_g = { LOG, "log", /* name */ @@ -117,7 +119,6 @@ static const H5VL_class_t H5VL_log_g = { typedef struct H5VL_log_t { void *under_object; - H5VL_t *under_plugin; } H5VL_log_t; static herr_t @@ -164,13 +165,19 @@ int main(int argc, char **argv) { under_fapl = H5Pcreate (H5P_FILE_ACCESS); H5Pset_fapl_native(under_fapl); + assert(H5VLis_registered("native") == 1); + vol_id = H5VLregister (&H5VL_log_g); - assert(H5VLis_registered(&H5VL_log_g) == 1); + assert(vol_id > 0); + assert(H5VLis_registered("log") == 1); - vol_id2 = H5VLget_plugin_id(&H5VL_log_g); + vol_id2 = H5VLget_plugin_id("log"); H5VLinitialize(vol_id2, H5P_DEFAULT); H5VLclose(vol_id2); + native_plugin_id = H5VLget_plugin_id("native"); + assert(native_plugin_id > 0); + acc_tpl = H5Pcreate (H5P_FILE_ACCESS); H5Pset_vol(acc_tpl, vol_id, &under_fapl); @@ -248,9 +255,10 @@ int main(int argc, char **argv) { H5Pclose(acc_tpl); H5Pclose(under_fapl); + H5VLclose(native_plugin_id); H5VLterminate(vol_id, H5P_DEFAULT); H5VLunregister (vol_id); - assert(H5VLis_registered(&H5VL_log_g) == 0); + assert(H5VLis_registered("log") == 0); return 0; } @@ -275,7 +283,7 @@ H5VL_log_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl file = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); under_fapl = *((hid_t *)H5Pget_vol_info(fapl_id)); - file->under_object = H5VLfile_create(&(file->under_plugin), name, flags, fcpl_id, under_fapl, dxpl_id, req); + file->under_object = H5VLfile_create(name, flags, fcpl_id, under_fapl, dxpl_id, req); printf("------- LOG H5Fcreate\n"); return (void *)file; @@ -290,7 +298,7 @@ H5VL_log_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_i file = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); under_fapl = *((hid_t *)H5Pget_vol_info(fapl_id)); - file->under_object = H5VLfile_open(&(file->under_plugin), name, flags, under_fapl, dxpl_id, req); + file->under_object = H5VLfile_open(name, flags, under_fapl, dxpl_id, req); printf("------- LOG H5Fopen\n"); return (void *)file; @@ -301,7 +309,7 @@ H5VL_log_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **re { H5VL_log_t *f = (H5VL_log_t *)file; - H5VLfile_get(f->under_object, f->under_plugin, get_type, dxpl_id, req, arguments); + H5VLfile_get(f->under_object, native_plugin_id, get_type, dxpl_id, req, arguments); printf("------- LOG H5Fget %d\n", get_type); return 1; @@ -311,7 +319,7 @@ H5VL_log_file_close(void *file, hid_t dxpl_id, void **req) { H5VL_log_t *f = (H5VL_log_t *)file; - H5VLfile_close(f->under_object, f->under_plugin, dxpl_id, req); + H5VLfile_close(f->under_object, native_plugin_id, dxpl_id, req); free(f); printf("------- LOG H5Fclose\n"); @@ -327,8 +335,7 @@ H5VL_log_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, group = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - group->under_object = H5VLgroup_create(o->under_object, loc_params, o->under_plugin, name, gcpl_id, gapl_id, dxpl_id, req); - group->under_plugin = o->under_plugin; + group->under_object = H5VLgroup_create(o->under_object, loc_params, native_plugin_id, name, gcpl_id, gapl_id, dxpl_id, req); printf("------- LOG H5Gcreate\n"); return (void *)group; @@ -339,7 +346,7 @@ H5VL_log_group_close(void *grp, hid_t dxpl_id, void **req) { H5VL_log_t *g = (H5VL_log_t *)grp; - H5VLgroup_close(g->under_object, g->under_plugin, dxpl_id, req); + H5VLgroup_close(g->under_object, native_plugin_id, dxpl_id, req); free(g); printf("------- LOG H5Gclose\n"); @@ -355,9 +362,8 @@ H5VL_log_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *na dt = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - dt->under_object = H5VLdatatype_commit(o->under_object, loc_params, o->under_plugin, name, + dt->under_object = H5VLdatatype_commit(o->under_object, loc_params, native_plugin_id, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req); - dt->under_plugin = o->under_plugin; printf("------- LOG H5Tcommit\n"); return dt; @@ -370,8 +376,7 @@ H5VL_log_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name dt = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - dt->under_object = H5VLdatatype_open(o->under_object, loc_params, o->under_plugin, name, tapl_id, dxpl_id, req); - dt->under_plugin = o->under_plugin; + dt->under_object = H5VLdatatype_open(o->under_object, loc_params, native_plugin_id, name, tapl_id, dxpl_id, req); printf("------- LOG H5Topen\n"); return (void *)dt; @@ -383,7 +388,7 @@ H5VL_log_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, voi H5VL_log_t *o = (H5VL_log_t *)dt; herr_t ret_value; - ret_value = H5VLdatatype_get(o->under_object, o->under_plugin, get_type, dxpl_id, req, arguments); + ret_value = H5VLdatatype_get(o->under_object, native_plugin_id, get_type, dxpl_id, req, arguments); printf("------- LOG datatype get\n"); return ret_value; @@ -395,9 +400,8 @@ H5VL_log_datatype_close(void *dt, hid_t dxpl_id, void **req) H5VL_log_t *type = (H5VL_log_t *)dt; assert(type->under_object); - assert(type->under_plugin); - H5VLdatatype_close(type->under_object, type->under_plugin, dxpl_id, req); + H5VLdatatype_close(type->under_object, native_plugin_id, dxpl_id, req); free(type); printf("------- LOG H5Tclose\n"); @@ -412,8 +416,7 @@ H5VL_log_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened new_obj = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - new_obj->under_object = H5VLobject_open(o->under_object, loc_params, o->under_plugin, opened_type, dxpl_id, req); - new_obj->under_plugin = o->under_plugin; + new_obj->under_object = H5VLobject_open(o->under_object, loc_params, native_plugin_id, opened_type, dxpl_id, req); printf("------- LOG H5Oopen\n"); return (void *)new_obj; @@ -425,7 +428,7 @@ H5VL_log_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_sp { H5VL_log_t *o = (H5VL_log_t *)obj; - H5VLobject_specific(o->under_object, loc_params, o->under_plugin, specific_type, dxpl_id, req, arguments); + H5VLobject_specific(o->under_object, loc_params, native_plugin_id, specific_type, dxpl_id, req, arguments); printf("------- LOG Object specific\n"); return 1; @@ -439,8 +442,7 @@ H5VL_log_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *nam dset = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - dset->under_object = H5VLdataset_create(o->under_object, loc_params, o->under_plugin, name, dcpl_id, dapl_id, dxpl_id, req); - dset->under_plugin = o->under_plugin; + dset->under_object = H5VLdataset_create(o->under_object, loc_params, native_plugin_id, name, dcpl_id, dapl_id, dxpl_id, req); printf("------- LOG H5Dcreate\n"); return (void *)dset; @@ -454,8 +456,7 @@ H5VL_log_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, dset = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - dset->under_object = H5VLdataset_open(o->under_object, loc_params, o->under_plugin, name, dapl_id, dxpl_id, req); - dset->under_plugin = o->under_plugin; + dset->under_object = H5VLdataset_open(o->under_object, loc_params, native_plugin_id, name, dapl_id, dxpl_id, req); printf("------- LOG H5Dopen\n"); return (void *)dset; @@ -467,7 +468,7 @@ H5VL_log_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, { H5VL_log_t *d = (H5VL_log_t *)dset; - H5VLdataset_read(d->under_object, d->under_plugin, mem_type_id, mem_space_id, file_space_id, + H5VLdataset_read(d->under_object, native_plugin_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); printf("------- LOG H5Dread\n"); @@ -479,7 +480,7 @@ H5VL_log_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, { H5VL_log_t *d = (H5VL_log_t *)dset; - H5VLdataset_write(d->under_object, d->under_plugin, mem_type_id, mem_space_id, file_space_id, + H5VLdataset_write(d->under_object, native_plugin_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); printf("------- LOG H5Dwrite\n"); @@ -490,7 +491,7 @@ H5VL_log_dataset_close(void *dset, hid_t dxpl_id, void **req) { H5VL_log_t *d = (H5VL_log_t *)dset; - H5VLdataset_close(d->under_object, d->under_plugin, dxpl_id, req); + H5VLdataset_close(d->under_object, native_plugin_id, dxpl_id, req); free(d); printf("------- LOG H5Dclose\n"); diff --git a/src/H5A.c b/src/H5A.c index 6b20c56..709a05f 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -274,17 +274,17 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the attribute through the VOL */ - if(NULL == (attr = H5VL_attr_create(obj, loc_params, vol_plugin, attr_name, acpl_id, aapl_id, + if(NULL == (attr = H5VL_attr_create(obj, loc_params, vol_plugin->cls, attr_name, acpl_id, aapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create attribute") - /* Get an atom for the attribute */ - if((ret_value = H5I_register2(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attr handle") + /* Get an atom for the attribute with the VOL information as the auxilary struct*/ + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") done: if (ret_value < 0 && attr) - if(H5VL_attr_close(attr, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + if(H5VL_attr_close(attr, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr") FUNC_LEAVE_API(ret_value) @@ -374,17 +374,17 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the attribute through the VOL */ - if(NULL == (attr = H5VL_attr_create(obj, loc_params, vol_plugin, attr_name, acpl_id, + if(NULL == (attr = H5VL_attr_create(obj, loc_params, vol_plugin->cls, attr_name, acpl_id, aapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create attribute") - /* Get an atom for the attribute */ - if((ret_value = H5I_register2(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attr handle") + /* Get an atom for the attribute with the VOL information as the auxilary struct*/ + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attribute handle") done: if (ret_value < 0 && attr) - if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + if(H5VL_attr_close (attr, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr") FUNC_LEAVE_API(ret_value) } /* H5Acreate_by_name() */ @@ -439,17 +439,17 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the attribute through the VOL */ - if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin, attr_name, aapl_id, + if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin->cls, attr_name, aapl_id, H5AC_ind_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") - /* Get an atom for the attribute */ - if((ret_value = H5I_register2(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attr handle") + /* Get an atom for the attribute with the VOL information as the auxilary struct*/ + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attribute handle") done: if (ret_value < 0 && attr) - if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + if(H5VL_attr_close (attr, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr") FUNC_LEAVE_API(ret_value) } /* H5Aopen() */ @@ -516,17 +516,17 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the attribute through the VOL */ - if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin, attr_name, aapl_id, + if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin->cls, attr_name, aapl_id, H5AC_ind_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") - /* Get an atom for the attribute */ - if((ret_value = H5I_register2(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attr handle") + /* Get an atom for the attribute with the VOL information as the auxilary struct*/ + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attribute handle") done: if (ret_value < 0 && attr) - if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + if(H5VL_attr_close (attr, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr") FUNC_LEAVE_API(ret_value) } /* H5Aopen_by_name() */ @@ -602,17 +602,17 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the attribute through the VOL */ - if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin, NULL, aapl_id, + if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin->cls, NULL, aapl_id, H5AC_ind_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") - /* Get an atom for the attribute */ - if((ret_value = H5I_register2(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attr handle") + /* Get an atom for the attribute with the VOL information as the auxilary struct*/ + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attribute handle") done: if (ret_value < 0 && attr) - if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + if(H5VL_attr_close (attr, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr") FUNC_LEAVE_API(ret_value) } /* H5Aopen_by_idx() */ @@ -655,7 +655,7 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* write the data through the VOL */ - if((ret_value = H5VL_attr_write(attr, vol_plugin, dtype_id, buf, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) + if((ret_value = H5VL_attr_write(attr, vol_plugin->cls, dtype_id, buf, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "can't read data") done: @@ -700,7 +700,7 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Read the data through the VOL */ - if((ret_value = H5VL_attr_read(attr, vol_plugin, dtype_id, buf, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) + if((ret_value = H5VL_attr_read(attr, vol_plugin->cls, dtype_id, buf, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "can't read data") done: @@ -743,7 +743,7 @@ H5Aget_space(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* get the dataspace through the VOL */ - if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_SPACE, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_attr_get(attr, vol_plugin->cls, H5VL_ATTR_GET_SPACE, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get data space") done: @@ -786,7 +786,7 @@ H5Aget_type(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* get the datatype through the VOL */ - if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_TYPE, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_attr_get(attr, vol_plugin->cls, H5VL_ATTR_GET_TYPE, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get type") done: @@ -834,7 +834,7 @@ H5Aget_create_plist(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* get the acpl through the VOL */ - if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_ACPL, H5AC_dxpl_id, + if(H5VL_attr_get(attr, vol_plugin->cls, H5VL_ATTR_GET_ACPL, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get acpl") @@ -889,7 +889,7 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* get the name through the VOL */ - if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_NAME, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + if(H5VL_attr_get(attr, vol_plugin->cls, H5VL_ATTR_GET_NAME, H5AC_ind_dxpl_id, H5_REQUEST_NULL, loc_params, buf_size, buf, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get name") @@ -960,7 +960,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* get the name through the VOL */ - if(H5VL_attr_get(obj, vol_plugin, H5VL_ATTR_GET_NAME, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + if(H5VL_attr_get(obj, vol_plugin->cls, H5VL_ATTR_GET_NAME, H5AC_ind_dxpl_id, H5_REQUEST_NULL, loc_params, size, name, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get name") @@ -1005,7 +1005,7 @@ H5Aget_storage_size(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "ID does not contain VOL information") /* get the storage size through the VOL */ - if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_STORAGE_SIZE, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_attr_get(attr, vol_plugin->cls, H5VL_ATTR_GET_STORAGE_SIZE, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, 0, "unable to get acpl") done: @@ -1049,7 +1049,7 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo) loc_params.obj_type = H5I_get_type(attr_id); /* get the attribute info through the VOL */ - if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_INFO, H5AC_ind_dxpl_id, + if(H5VL_attr_get(attr, vol_plugin->cls, H5VL_ATTR_GET_INFO, H5AC_ind_dxpl_id, H5_REQUEST_NULL, loc_params, ainfo) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get attribute info") @@ -1111,7 +1111,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* get the attribute info through the VOL */ - if(H5VL_attr_get(obj, vol_plugin, H5VL_ATTR_GET_INFO, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + if(H5VL_attr_get(obj, vol_plugin->cls, H5VL_ATTR_GET_INFO, H5AC_ind_dxpl_id, H5_REQUEST_NULL, loc_params, ainfo, attr_name) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get attribute info") @@ -1180,7 +1180,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* get the attribute info through the VOL */ - if(H5VL_attr_get(obj, vol_plugin, H5VL_ATTR_GET_INFO, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + if(H5VL_attr_get(obj, vol_plugin->cls, H5VL_ATTR_GET_INFO, H5AC_ind_dxpl_id, H5_REQUEST_NULL, loc_params, ainfo) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get attribute info") @@ -1233,7 +1233,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* rename the attribute info through the VOL */ - if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin, H5VL_ATTR_RENAME, + if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin->cls, H5VL_ATTR_RENAME, H5AC_dxpl_id, H5_REQUEST_NULL, old_name, new_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } @@ -1299,7 +1299,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* rename the attribute info through the VOL */ - if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin, H5VL_ATTR_RENAME, + if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin->cls, H5VL_ATTR_RENAME, H5AC_dxpl_id, H5_REQUEST_NULL, old_attr_name, new_attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") @@ -1382,7 +1382,7 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* iterate over the links through the VOL */ - if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin, H5VL_ATTR_ITER, + if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin->cls, H5VL_ATTR_ITER, H5AC_dxpl_id, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "attribute iteration failed") @@ -1477,7 +1477,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* iterate over the links through the VOL */ - if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin, H5VL_ATTR_ITER, + if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin->cls, H5VL_ATTR_ITER, H5AC_dxpl_id, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "attribute iteration failed") @@ -1529,7 +1529,7 @@ H5Adelete(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute through the VOL */ - if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin, H5VL_ATTR_DELETE, + if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin->cls, H5VL_ATTR_DELETE, H5AC_dxpl_id, H5_REQUEST_NULL, name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1592,7 +1592,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute through the VOL */ - if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin, H5VL_ATTR_DELETE, + if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin->cls, H5VL_ATTR_DELETE, H5AC_dxpl_id, H5_REQUEST_NULL, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1668,7 +1668,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute through the VOL */ - if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin, H5VL_ATTR_DELETE, + if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin->cls, H5VL_ATTR_DELETE, H5AC_dxpl_id, H5_REQUEST_NULL, NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1755,7 +1755,7 @@ H5Aexists(hid_t obj_id, const char *attr_name) loc_params.obj_type = H5I_get_type(obj_id); /* Check existence of attribute through the VOL */ - if(H5VL_attr_specific(obj, loc_params, vol_plugin, H5VL_ATTR_EXISTS, + if(H5VL_attr_specific(obj, loc_params, vol_plugin->cls, H5VL_ATTR_EXISTS, H5AC_ind_dxpl_id, H5_REQUEST_NULL, attr_name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: @@ -1814,7 +1814,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, loc_params.obj_type = H5I_get_type(loc_id); /* Check existence of attribute through the VOL */ - if(H5VL_attr_specific(obj, loc_params, vol_plugin, H5VL_ATTR_EXISTS, + if(H5VL_attr_specific(obj, loc_params, vol_plugin->cls, H5VL_ATTR_EXISTS, H5AC_ind_dxpl_id, H5_REQUEST_NULL, attr_name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") @@ -1845,9 +1845,13 @@ H5A_close_attr(void *attr, H5VL_t *vol_plugin) FUNC_ENTER_NOAPI_NOINIT /* Close the attr through the VOL*/ - if((ret_value = H5VL_attr_close(attr, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) + if((ret_value = H5VL_attr_close(attr, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to close attribute") + /* decrement ref count on VOL ID */ + if(H5VL_free_id(vol_plugin) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_close_attr() */ diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 24cee31..75d1665 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -205,16 +205,16 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the attribute through the VOL */ - if(NULL == (attr = H5VL_attr_create(obj, loc_params, vol_plugin, name, plist_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_create(obj, loc_params, vol_plugin->cls, name, plist_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create attribute") - /* Get an atom for the attribute */ - if((ret_value = H5I_register2(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") + /* Get an atom for the attribute with the VOL information as the auxilary struct*/ + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attribute handle") done: if (ret_value < 0 && attr) - if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + if(H5VL_attr_close (attr, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* H5Acreate1() */ @@ -272,17 +272,17 @@ H5Aopen_name(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the attribute through the VOL */ - if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin, name, H5P_DEFAULT, + if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin->cls, name, H5P_DEFAULT, H5AC_ind_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open attribute") - /* Get an atom for the attribute */ - if((ret_value = H5I_register2(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") + /* Get an atom for the attribute with the VOL information as the auxilary struct*/ + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attribute handle") done: if (ret_value < 0 && attr) - if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + if(H5VL_attr_close (attr, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* H5Aopen_name() */ @@ -342,17 +342,17 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the attribute through the VOL */ - if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin, NULL, H5P_DEFAULT, + if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin->cls, NULL, H5P_DEFAULT, H5AC_ind_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open attribute") - /* Get an atom for the attribute */ - if((ret_value = H5I_register2(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") + /* Get an atom for the attribute with the VOL information as the auxilary struct*/ + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attribute handle") done: if (ret_value < 0 && attr) - if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + if(H5VL_attr_close (attr, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* H5Aopen_idx() */ @@ -399,7 +399,7 @@ H5Aget_num_attrs(hid_t loc_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the group info through the VOL using the location token */ - if(H5VL_object_optional(obj, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + if(H5VL_object_optional(obj, vol_plugin->cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, &oinfo) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") diff --git a/src/H5Aint.c b/src/H5Aint.c index f67e6f4..b812d56 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -2468,20 +2468,6 @@ herr_t H5A_iterate(void *obj, H5VL_loc_params_t loc_params, H5_index_t idx_type, if(loc_params.type == H5VL_OBJECT_BY_SELF) { if((obj_loc_id = H5VL_native_register(loc_params.obj_type, obj, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") -#if 0 - /* Build the vol plugin struct */ - if(NULL == (vol_plugin = (H5VL_t *)H5MM_calloc(sizeof(H5VL_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - vol_plugin->cls = &H5VL_native_g; - vol_plugin->nrefs = 1; - vol_plugin->id = H5VL_NATIVE_g; - if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin") - - /* Get an atom for the object */ - if((obj_loc_id = H5I_register2(loc_params.obj_type, obj, vol_plugin, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register object") -#endif } else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* Set up opened group location to fill in */ diff --git a/src/H5D.c b/src/H5D.c index bd77414..2995a73 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -206,16 +206,16 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the dataset through the VOL */ - if(NULL == (dset = H5VL_dataset_create(obj, loc_params, vol_plugin, name, dcpl_id, dapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_create(obj, loc_params, vol_plugin->cls, name, dcpl_id, dapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") - /* Get an atom for the dataset */ - if((ret_value = H5I_register2(H5I_DATASET, dset, vol_plugin, TRUE)) < 0) + /* Get an atom for the dataset with the VOL information as the auxilary struct*/ + if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") done: if (ret_value < 0 && dset) - if(H5VL_dataset_close (dset, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + if(H5VL_dataset_close (dset, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dcreate2() */ @@ -306,16 +306,16 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the dataset through the VOL */ - if(NULL == (dset = H5VL_dataset_create(obj, loc_params, vol_plugin, NULL, dcpl_id, dapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_create(obj, loc_params, vol_plugin->cls, NULL, dcpl_id, dapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") - /* Get an atom for the dataset */ - if((ret_value = H5I_register2(H5I_DATASET, dset, vol_plugin, TRUE)) < 0) + /* Get an atom for the dataset with the VOL information as the auxilary struct*/ + if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") done: if (ret_value < 0 && dset) - if(H5VL_dataset_close (dset, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + if(H5VL_dataset_close (dset, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dcreate_anon() */ @@ -373,16 +373,16 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the dataset through the VOL */ - if(NULL == (dset = H5VL_dataset_open(obj, loc_params, vol_plugin, name, dapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_open(obj, loc_params, vol_plugin->cls, name, dapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset") - /* Get an atom for the dataset */ - if((ret_value = H5I_register2(H5I_DATASET, dset, vol_plugin, TRUE)) < 0) + /* Get an atom for the dataset with the VOL information as the auxilary struct*/ + if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") done: if (ret_value < 0 && dset) - if(H5VL_dataset_close (dset, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + if(H5VL_dataset_close (dset, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dopen2() */ @@ -464,7 +464,7 @@ H5Dget_space(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* get the dataspace through the VOL */ - if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_SPACE, H5AC_dxpl_id, + if(H5VL_dataset_get(dset, vol_plugin->cls, H5VL_DATASET_GET_SPACE, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get data space") @@ -505,7 +505,7 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Read data space address through the VOL and return */ - if((ret_value = H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_SPACE_STATUS, + if((ret_value = H5VL_dataset_get(dset, vol_plugin->cls, H5VL_DATASET_GET_SPACE_STATUS, H5AC_ind_dxpl_id, H5_REQUEST_NULL, allocation)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get space status") @@ -548,7 +548,7 @@ H5Dget_type(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* get the datatype through the VOL */ - if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_TYPE, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(dset, vol_plugin->cls, H5VL_DATASET_GET_TYPE, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get datatype") done: @@ -589,7 +589,7 @@ H5Dget_create_plist(hid_t dset_id) if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(dset_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_DCPL, H5AC_dxpl_id, + if(H5VL_dataset_get(dset, vol_plugin->cls, H5VL_DATASET_GET_DCPL, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataset creation properties") @@ -648,7 +648,7 @@ H5Dget_access_plist(hid_t dset_id) if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(dset_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_DAPL, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(dset, vol_plugin->cls, H5VL_DATASET_GET_DAPL, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataset access properties") done: @@ -692,7 +692,7 @@ H5Dget_storage_size(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "ID does not contain VOL information") /* get storage size through the VOL */ - if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_STORAGE_SIZE, + if(H5VL_dataset_get(dset, vol_plugin->cls, H5VL_DATASET_GET_STORAGE_SIZE, H5AC_ind_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, 0, "unable to get storage size") @@ -733,7 +733,7 @@ H5Dget_offset(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "ID does not contain VOL information") /* get offset through the VOL */ - if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_OFFSET, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(dset, vol_plugin->cls, H5VL_DATASET_GET_OFFSET, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, HADDR_UNDEF, "unable to get offset") done: @@ -934,13 +934,13 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, /* Save the dataset & VOL plugin */ vlen_bufsize.dset = dset; - vlen_bufsize.vol_plugin = vol_plugin; + vlen_bufsize.vol_cls = vol_plugin->cls; vlen_bufsize.fspace_id = FAIL; vlen_bufsize.mspace_id = FAIL; /* Get a copy of the dataspace ID */ - if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_SPACE, H5AC_dxpl_id, + if(H5VL_dataset_get(dset, vol_plugin->cls, H5VL_DATASET_GET_SPACE, H5AC_dxpl_id, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy dataspace") @@ -1035,7 +1035,7 @@ H5Dset_extent(hid_t dset_id, const hsize_t size[]) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* set the extent through the VOL */ - if((ret_value = H5VL_dataset_specific(dset, vol_plugin, H5VL_DATASET_SET_EXTENT, + if((ret_value = H5VL_dataset_specific(dset, vol_plugin->cls, H5VL_DATASET_SET_EXTENT, H5AC_dxpl_id, H5_REQUEST_NULL, size)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extent of dataset") @@ -1066,9 +1066,17 @@ H5D_close_dataset(void *dset, H5VL_t *vol_plugin) FUNC_ENTER_NOAPI_NOINIT /* Close the dataset through the VOL */ - if((ret_value = H5VL_dataset_close(dset, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) + if((ret_value = H5VL_dataset_close(dset, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset") done: + /* MSC - Weird thing for datasets and filters: + Always decrement the ref count on the vol for datasets, since + the ID is removed even if the close fails */ + + /* decrement ref count on VOL ID */ + if(H5VL_free_id(vol_plugin) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_close_dataset() */ diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 9df3317..6dd0ebb 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -206,17 +206,17 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the dataset through the VOL */ - if(NULL == (dset = H5VL_dataset_create(obj, loc_params, vol_plugin, name, dcpl_id, + if(NULL == (dset = H5VL_dataset_create(obj, loc_params, vol_plugin->cls, name, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") - /* Get an atom for the dataset */ - if((ret_value = H5I_register2(H5I_DATASET, dset, vol_plugin, TRUE)) < 0) + /* Get an atom for the dataset with the VOL information as the auxilary struct*/ + if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") done: if (ret_value < 0 && dset) - if(H5VL_dataset_close (dset, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + if(H5VL_dataset_close (dset, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dcreate1() */ @@ -268,16 +268,16 @@ H5Dopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the dataset through the VOL */ - if(NULL == (dset = H5VL_dataset_open(obj, loc_params, vol_plugin, name, dapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_open(obj, loc_params, vol_plugin->cls, name, dapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") - /* Get an atom for the dataset */ - if((ret_value = H5I_register2(H5I_DATASET, dset, vol_plugin, TRUE)) < 0) + /* Get an atom for the dataset with the VOL information as the auxilary struct*/ + if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") done: if (ret_value < 0 && dset) - if(H5VL_dataset_close (dset, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + if(H5VL_dataset_close (dset, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dopen1() */ diff --git a/src/H5Dint.c b/src/H5Dint.c index 534a050..a1d062fa 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -2085,7 +2085,7 @@ H5D__vlen_get_buf_size(void UNUSED *elem, hid_t type_id, unsigned UNUSED ndim, c HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point") /* Read in the point (with the custom VL memory allocator) */ - if(H5VL_dataset_read(vlen_bufsize->dset, vlen_bufsize->vol_plugin, + if(H5VL_dataset_read(vlen_bufsize->dset, vlen_bufsize->vol_cls, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, vlen_bufsize->xfer_pid, vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0) diff --git a/src/H5Dio.c b/src/H5Dio.c index c5bfb19..015e5e0 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -165,7 +165,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Read the data through the VOL */ - if((ret_value = H5VL_dataset_read(dset, vol_plugin, mem_type_id, mem_space_id, + if((ret_value = H5VL_dataset_read(dset, vol_plugin->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data") @@ -268,7 +268,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Write the data through the VOL */ - if((ret_value = H5VL_dataset_write(dset, vol_plugin, mem_type_id, mem_space_id, + if((ret_value = H5VL_dataset_write(dset, vol_plugin->cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 9d828e4..86da45f 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -480,7 +480,7 @@ typedef struct H5D_fill_buf_info_t { /* Internal data structure for computing variable-length dataset's total size */ typedef struct { void *dset; /* Dataset for operation */ - H5VL_t *vol_plugin; /* VOL plugin the dataset belongs to */ + const H5VL_class_t *vol_cls; /* VOL plugin the dataset belongs to */ hid_t fspace_id; /* ID of the file dataset's dataspace we are working on */ hid_t mspace_id; /* ID of the memory dataset's dataspace we are working on */ void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */ diff --git a/src/H5F.c b/src/H5F.c index ff144c5..922fd45 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -218,7 +218,8 @@ H5Fget_create_plist(hid_t file_id) if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_FCPL, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_file_get(obj, vol_plugin->cls, H5VL_FILE_GET_FCPL, H5AC_dxpl_id, + H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file creation properties") done: @@ -265,7 +266,7 @@ H5Fget_access_plist(hid_t file_id) if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_file_get(file, vol_plugin, H5VL_FILE_GET_FAPL, H5AC_dxpl_id, + if(H5VL_file_get(file, vol_plugin->cls, H5VL_FILE_GET_FAPL, H5AC_dxpl_id, H5_REQUEST_NULL, &fapl_id) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file creation properties") @@ -337,7 +338,7 @@ H5Fget_obj_count(hid_t file_id, unsigned types) if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_OBJ_COUNT, H5AC_dxpl_id, + if(H5VL_file_get(obj, vol_plugin->cls, H5VL_FILE_GET_OBJ_COUNT, H5AC_dxpl_id, H5_REQUEST_NULL, types, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object count in file(s)") } @@ -449,7 +450,7 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) if(NULL == (obj = (void *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_OBJ_IDS, H5AC_dxpl_id, H5_REQUEST_NULL, + if(H5VL_file_get(obj, vol_plugin->cls, H5VL_FILE_GET_OBJ_IDS, H5AC_dxpl_id, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object count in file(s)") } @@ -525,7 +526,7 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle) if(NULL == (obj = (void *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(obj, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + if(H5VL_file_optional(obj, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL, H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file handle") @@ -607,9 +608,12 @@ done: hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { - void *file = NULL; /*file token from VOL plugin */ - H5VL_t *vol_plugin; /* VOL plugin information */ - hid_t ret_value; /*return value */ + void *file = NULL; /* file token from VOL plugin */ + H5VL_t *vol_plugin = NULL; /* VOL plugin information */ + H5P_genplist_t *plist; /* Property list pointer */ + hid_t plugin_id; /* VOL plugin identigier attached to fapl_id */ + H5VL_class_t *vol_cls = NULL; /* VOL Class structure for callback info */ + hid_t ret_value; /* return value */ FUNC_ENTER_API(FAIL) H5TRACE4("i", "*sIuii", filename, flags, fcpl_id, fapl_id); @@ -640,13 +644,30 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") + /* get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + if(H5P_get(plist, H5F_ACS_VOL_ID_NAME, &plugin_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol plugin ID") + + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + /* create a new file or truncate an existing file through the VOL */ - if(NULL == (file = H5VL_file_create(&vol_plugin, filename, flags, fcpl_id, fapl_id, + if(NULL == (file = H5VL_file_create(vol_cls, filename, flags, fcpl_id, fapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file") + /* Build the vol plugin struct */ + if(NULL == (vol_plugin = (H5VL_t *)H5MM_calloc(sizeof(H5VL_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + + vol_plugin->cls = vol_cls; + vol_plugin->nrefs = 0; + vol_plugin->id = plugin_id; + /* Get an atom for the file with the VOL information as the auxilary struct*/ - if((ret_value = H5I_register2(H5I_FILE, file, vol_plugin, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_FILE, file, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") done: @@ -697,9 +718,12 @@ done: hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { - void *file = NULL; /*file token from VOL plugin */ - H5VL_t *vol_plugin; /* VOL plugin information */ - hid_t ret_value; /*return value */ + void *file = NULL; /* file token from VOL plugin */ + H5VL_t *vol_plugin = NULL; /* VOL plugin information */ + H5P_genplist_t *plist; /* Property list pointer */ + hid_t plugin_id; /* VOL plugin identigier attached to fapl_id */ + H5VL_class_t *vol_cls = NULL; /* VOL Class structure for callback info */ + hid_t ret_value; /* return value */ FUNC_ENTER_API(FAIL) H5TRACE3("i", "*sIui", filename, flags, fapl_id); @@ -717,12 +741,29 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") + /* get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + if(H5P_get(plist, H5F_ACS_VOL_ID_NAME, &plugin_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol plugin ID") + + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + /* Open the file through the VOL layer */ - if(NULL == (file = H5VL_file_open(&vol_plugin, filename, flags, fapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) + if(NULL == (file = H5VL_file_open(vol_cls, filename, flags, fapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file") + /* Build the vol plugin struct */ + if(NULL == (vol_plugin = (H5VL_t *)H5MM_calloc(sizeof(H5VL_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + + vol_plugin->cls = vol_cls; + vol_plugin->nrefs = 0; + vol_plugin->id = plugin_id; + /* Get an atom for the file with the VOL information as the auxilary struct*/ - if((ret_value = H5I_register2(H5I_FILE, file, vol_plugin, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_FILE, file, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") done: @@ -769,7 +810,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) if(NULL == (obj = (void *)H5VL_get_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_specific(obj, vol_plugin, H5VL_FILE_FLUSH, H5AC_dxpl_id, + if(H5VL_file_specific(obj, vol_plugin->cls, H5VL_FILE_FLUSH, H5AC_dxpl_id, H5_REQUEST_NULL, obj_type, scope) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file") @@ -842,8 +883,13 @@ H5F_close_file(void *file, H5VL_t *vol_plugin) FUNC_ENTER_NOAPI_NOINIT /* Close the file through the VOL*/ - if((ret_value = H5VL_file_close(file, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) + if((ret_value = H5VL_file_close(file, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + + /* decrement ref count on VOL ID */ + if(H5VL_free_id(vol_plugin) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_close_file() */ @@ -890,19 +936,15 @@ H5Freopen(hid_t file_id) if(NULL == (obj = (void *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(obj, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + if(H5VL_file_optional(obj, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL, H5VL_FILE_REOPEN, &file) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") if (NULL == file) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") - vol_plugin->nrefs ++; - if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin") - /* Get an atom for the file with the VOL information as the auxilary struct*/ - if((ret_value = H5I_register2(H5I_FILE, file, vol_plugin, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_FILE, file, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") done: @@ -944,7 +986,7 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags) if(NULL == (obj = (void *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if((ret_value = H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_INTENT, + if((ret_value = H5VL_file_get(obj, vol_plugin->cls, H5VL_FILE_GET_INTENT, H5AC_dxpl_id, H5_REQUEST_NULL, intent_flags)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file intent") } @@ -986,7 +1028,7 @@ H5Fget_freespace(hid_t file_id) if(NULL == (obj = (void *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(obj, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + if(H5VL_file_optional(obj, vol_plugin->cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file free space") @@ -1029,7 +1071,7 @@ H5Fget_filesize(hid_t file_id, hsize_t *size) if(NULL == (file = (void *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - if(H5VL_file_optional(file, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + if(H5VL_file_optional(file, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL, H5VL_FILE_GET_SIZE, size) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file size") @@ -1098,7 +1140,7 @@ H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* get image through the VOL */ - if(H5VL_file_optional(file, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + if(H5VL_file_optional(file, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL, H5VL_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file image") @@ -1147,7 +1189,7 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) if(NULL == (obj = (void *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(obj, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + if(H5VL_file_optional(obj, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_CONF, config_ptr) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get mdc configuration") @@ -1188,7 +1230,7 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) if(NULL == (obj = (void *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(obj, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + if(H5VL_file_optional(obj, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL, H5VL_FILE_SET_MDC_CONFIG, config_ptr) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "uanvle to set MDC configuration") @@ -1234,7 +1276,7 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr) if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_file_optional(file, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + if(H5VL_file_optional(file, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get MDC hit rate") @@ -1280,7 +1322,7 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_file_optional(file, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_SIZE, + if(H5VL_file_optional(file, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_SIZE, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get MDC size") @@ -1327,7 +1369,7 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id) if(NULL == (obj = (void *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(obj, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + if(H5VL_file_optional(obj, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL, H5VL_FILE_RESET_MDC_HIT_RATE) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate") @@ -1383,7 +1425,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) if(NULL == (obj = (void *)H5VL_get_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_NAME, H5AC_dxpl_id, H5_REQUEST_NULL, + if(H5VL_file_get(obj, vol_plugin->cls, H5VL_FILE_GET_NAME, H5AC_dxpl_id, H5_REQUEST_NULL, type, size, name, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file name") @@ -1438,7 +1480,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) if(NULL == (obj = (void *)H5VL_get_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(obj, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + if(H5VL_file_optional(obj, vol_plugin->cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, finfo) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file info") done: @@ -1482,7 +1524,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_file_optional(file, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + if(H5VL_file_optional(file, vol_plugin->cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, type, nsects) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file free sections") done: @@ -1522,7 +1564,7 @@ H5Fclear_elink_file_cache(hid_t file_id) if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_file_optional(file, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + if(H5VL_file_optional(file, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL, H5VL_FILE_CLEAR_ELINK_CACHE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") diff --git a/src/H5Fint.c b/src/H5Fint.c index 8224d90..96ea58a 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -280,7 +280,7 @@ H5F_get_obj_count_cb(void UNUSED *obj_ptr, hid_t obj_id, void *key) if(NULL == (obj = (void *)H5I_object_verify(obj_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file id") - if(H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_OBJ_COUNT, H5AC_dxpl_id, H5_REQUEST_NULL, + if(H5VL_file_get(obj, vol_plugin->cls, H5VL_FILE_GET_OBJ_COUNT, H5AC_dxpl_id, H5_REQUEST_NULL, udata->types, &obj_count) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, H5_ITER_ERROR, "unable to get object count in file(s)") @@ -355,7 +355,7 @@ H5F_get_obj_ids_cb(void UNUSED *obj_ptr, hid_t obj_id, void *key) if(NULL == (obj = (void *)H5I_object_verify(obj_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_OBJ_IDS, H5AC_dxpl_id, H5_REQUEST_NULL, + if(H5VL_file_get(obj, vol_plugin->cls, H5VL_FILE_GET_OBJ_IDS, H5AC_dxpl_id, H5_REQUEST_NULL, udata->types, udata->max_objs, udata->oid_list, &obj_count) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, H5_ITER_ERROR, "unable to get object count in file(s)") diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 500852d..b9fc596 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -509,7 +509,7 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) if(NULL == (file = (void *)H5I_object(child_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_specific(obj, vol_plugin1, H5VL_FILE_MOUNT, H5AC_dxpl_id, + if(H5VL_file_specific(obj, vol_plugin1->cls, H5VL_FILE_MOUNT, H5AC_dxpl_id, H5_REQUEST_NULL, type, name, file, plist_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file") @@ -565,7 +565,7 @@ H5Funmount(hid_t loc_id, const char *name) if(NULL == (obj = (void *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_specific(obj, vol_plugin, H5VL_FILE_UNMOUNT, H5AC_dxpl_id, + if(H5VL_file_specific(obj, vol_plugin->cls, H5VL_FILE_UNMOUNT, H5AC_dxpl_id, H5_REQUEST_NULL, type, name) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file") diff --git a/src/H5G.c b/src/H5G.c index f182881..7d2bcb4 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -329,17 +329,17 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t g HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the group through the VOL */ - if(NULL == (grp = H5VL_group_create(obj, loc_params, vol_plugin, name, gcpl_id, gapl_id, + if(NULL == (grp = H5VL_group_create(obj, loc_params, vol_plugin->cls, name, gcpl_id, gapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") - /* Get an atom for the group */ - if((ret_value = H5I_register2(H5I_GROUP, grp, vol_plugin, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") + /* Get an atom for the group with the VOL information as the auxilary struct*/ + if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize group handle") done: if (ret_value < 0 && grp) - if(H5VL_group_close (grp, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + if(H5VL_group_close (grp, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") FUNC_LEAVE_API(ret_value) } /* end H5Gcreate2() */ @@ -418,17 +418,17 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the group through the VOL */ - if(NULL == (grp = H5VL_group_create(obj, loc_params, vol_plugin, NULL, gcpl_id, gapl_id, + if(NULL == (grp = H5VL_group_create(obj, loc_params, vol_plugin->cls, NULL, gcpl_id, gapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") - /* Get an atom for the group */ - if((ret_value = H5I_register2(H5I_GROUP, grp, vol_plugin, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") + /* Get an atom for the group with the VOL information as the auxilary struct*/ + if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize group handle") done: if (ret_value < 0 && grp) - if(H5VL_group_close (grp, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + if(H5VL_group_close (grp, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") FUNC_LEAVE_API(ret_value) } /* end H5Gcreate_anon() */ @@ -486,17 +486,17 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the group through the VOL */ - if(NULL == (grp = H5VL_group_open(obj, loc_params, vol_plugin, name, gapl_id, + if(NULL == (grp = H5VL_group_open(obj, loc_params, vol_plugin->cls, name, gapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") - /* Get an atom for the group */ - if((ret_value = H5I_register2(H5I_GROUP, grp, vol_plugin, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") + /* Get an atom for the group with the VOL information as the auxilary struct*/ + if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize group handle") done: if (ret_value < 0 && grp) - if(H5VL_group_close (grp, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + if(H5VL_group_close (grp, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") FUNC_LEAVE_API(ret_value) } /* end H5Gopen2() */ @@ -536,7 +536,7 @@ H5Gget_create_plist(hid_t grp_id) if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(grp_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_group_get(grp, vol_plugin, H5VL_GROUP_GET_GCPL, H5AC_dxpl_id, H5_REQUEST_NULL, + if(H5VL_group_get(grp, vol_plugin->cls, H5VL_GROUP_GET_GCPL, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group creation properties") @@ -588,7 +588,7 @@ H5Gget_info(hid_t loc_id, H5G_info_t *grp_info) loc_params.obj_type = id_type; /* Get the group info through the VOL using the location token */ - if((ret_value = H5VL_group_get(obj, vol_plugin, H5VL_GROUP_GET_INFO, H5AC_ind_dxpl_id, + if((ret_value = H5VL_group_get(obj, vol_plugin->cls, H5VL_GROUP_GET_INFO, H5AC_ind_dxpl_id, H5_REQUEST_NULL, loc_params, grp_info)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") @@ -646,7 +646,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid group identifier") /* Get the group info through the VOL using the location token */ - if((ret_value = H5VL_group_get(obj, vol_plugin, H5VL_GROUP_GET_INFO, H5AC_ind_dxpl_id, + if((ret_value = H5VL_group_get(obj, vol_plugin->cls, H5VL_GROUP_GET_INFO, H5AC_ind_dxpl_id, H5_REQUEST_NULL, loc_params, grp_info)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") @@ -713,7 +713,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid group identifier") /* Get the group info through the VOL using the location token */ - if((ret_value = H5VL_group_get(obj, vol_plugin, H5VL_GROUP_GET_INFO, H5AC_ind_dxpl_id, + if((ret_value = H5VL_group_get(obj, vol_plugin->cls, H5VL_GROUP_GET_INFO, H5AC_ind_dxpl_id, H5_REQUEST_NULL, loc_params, grp_info)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") @@ -786,9 +786,13 @@ H5G_close_group(void *grp, H5VL_t *vol_plugin) FUNC_ENTER_NOAPI_NOINIT /* Close the group through the VOL*/ - if((ret_value = H5VL_group_close(grp, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) + if((ret_value = H5VL_group_close(grp, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to close group") + /* decrement ref count on VOL ID */ + if(H5VL_free_id(vol_plugin) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_close_group() */ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index f1451a9..22e09ed 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -286,20 +286,20 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the group through the VOL */ - if(NULL == (grp = H5VL_group_create(obj, loc_params, vol_plugin, name, tmp_gcpl, + if(NULL == (grp = H5VL_group_create(obj, loc_params, vol_plugin->cls, name, tmp_gcpl, H5P_GROUP_ACCESS_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") - /* Get an atom for the group */ - if((ret_value = H5I_register2(H5I_GROUP, grp, vol_plugin, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") + /* Get an atom for the group with the VOL information as the auxilary struct*/ + if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize group handle") done: if(tmp_gcpl > 0 && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT) if(H5I_dec_ref(tmp_gcpl) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release property list") if (ret_value < 0 && grp) - if(H5VL_group_close (grp, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + if(H5VL_group_close (grp, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -351,17 +351,17 @@ H5Gopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the group through the VOL */ - if(NULL == (grp = H5VL_group_open(obj, loc_params, vol_plugin, name, H5P_DEFAULT, + if(NULL == (grp = H5VL_group_open(obj, loc_params, vol_plugin->cls, name, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") - /* Get an atom for the group */ - if((ret_value = H5I_register2(H5I_GROUP, grp, vol_plugin, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") + /* Get an atom for the group with the VOL information as the auxilary struct*/ + if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize group handle") done: if (ret_value < 0 && grp) - if(H5VL_group_close (grp, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + if(H5VL_group_close (grp, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") FUNC_LEAVE_API(ret_value) } /* end H5Gopen1() */ @@ -424,7 +424,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target loc params") /* Create the link through the VOL */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, NULL, loc_params2, vol_plugin, + if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, NULL, loc_params2, vol_plugin->cls, lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ @@ -450,7 +450,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name") /* Create the link through the VOL */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, obj, loc_params, vol_plugin, + if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, obj, loc_params, vol_plugin->cls, lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end else if */ @@ -531,7 +531,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, /* Create the link through the VOL */ if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, obj2, loc_params2, - (vol_plugin1!=NULL ? vol_plugin1 : vol_plugin2), + (vol_plugin1!=NULL ? vol_plugin1->cls : vol_plugin2->cls), lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ @@ -562,7 +562,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name") /* Create the link through the VOL */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, obj, loc_params, vol_plugin, + if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, obj, loc_params, vol_plugin->cls, lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end else if */ @@ -610,7 +610,7 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the link through the VOL */ - if((ret_value = H5VL_link_move(obj, loc_params1, NULL, loc_params2, vol_plugin, + if((ret_value = H5VL_link_move(obj, loc_params1, NULL, loc_params2, vol_plugin->cls, H5P_DEFAULT, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") @@ -676,7 +676,7 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Move the link through the VOL */ if((ret_value = H5VL_link_move(obj1, loc_params1, obj2, loc_params2, - (vol_plugin1!=NULL ? vol_plugin1 : vol_plugin2), + (vol_plugin1!=NULL ? vol_plugin1->cls : vol_plugin2->cls), H5P_DEFAULT, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") @@ -719,7 +719,7 @@ H5Gunlink(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Delete the link through the VOL */ - if(H5VL_link_specific(obj, loc_params, vol_plugin, H5VL_LINK_DELETE, + if(H5VL_link_specific(obj, loc_params, vol_plugin->cls, H5VL_LINK_DELETE, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link") @@ -764,7 +764,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the link info through the VOL */ - if((ret_value = H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_GET_VAL, + if((ret_value = H5VL_link_get(obj, loc_params, vol_plugin->cls, H5VL_LINK_GET_VAL, H5AC_ind_dxpl_id, H5_REQUEST_NULL, buf, size)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link value") @@ -904,7 +904,7 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* set comment on object through the VOL */ - if(H5VL_object_optional(obj, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + if(H5VL_object_optional(obj, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to set comment value") @@ -965,7 +965,7 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_object_optional(obj, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + if(H5VL_object_optional(obj, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, loc_params, buf, bufsize, &size) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object comment") diff --git a/src/H5I.c b/src/H5I.c index 4839624..314adf2 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -2282,20 +2282,17 @@ H5Iget_file_id(hid_t obj_id) } /* Get the file through the VOL */ - if(H5VL_file_get(obj, vol_plugin, H5VL_OBJECT_GET_FILE, H5AC_dxpl_id, H5_REQUEST_NULL, type, &file) < 0) + if(H5VL_file_get(obj, vol_plugin->cls, H5VL_OBJECT_GET_FILE, H5AC_dxpl_id, + H5_REQUEST_NULL, type, &file) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to get file") if (NULL == file) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") /* Check if the ID already exists and procceed accordingly */ if (FAIL == (ret_value = H5I_get_id(file, H5I_FILE))) { - /* resurrect the ID */ - if((ret_value = H5I_register2(H5I_FILE, file, vol_plugin, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") - /* increment the ref count on the VOL plugin for the new ID */ - vol_plugin->nrefs ++; - if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin") + /* Get an atom for the file with the VOL information as the auxilary struct*/ + if((ret_value = H5VL_register_id(H5I_FILE, file, vol_plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") } else { /* Increment ref count on existing ID */ @@ -2478,7 +2475,7 @@ H5I__get_id_cb(void *_item, void UNUSED *_key, void *_udata) /*------------------------------------------------------------------------- * Function: H5I_get_id * - * Purpose: return ID of vol object + * Purpose: return ID of object * * Return: Success: id of object * Failure: FAIL diff --git a/src/H5L.c b/src/H5L.c index fe7b39c..7ce316a 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -328,7 +328,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Move the link through the VOL */ if(H5VL_link_move(obj1, loc_params1, obj2, loc_params2, - (vol_plugin1!=NULL ? vol_plugin1 : vol_plugin2), + (vol_plugin1!=NULL ? vol_plugin1->cls : vol_plugin2->cls), lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") @@ -419,7 +419,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Move the link through the VOL */ if(H5VL_link_copy(obj1, loc_params1, obj2, loc_params2, - (vol_plugin1!=NULL ? vol_plugin1 : vol_plugin2), + (vol_plugin1!=NULL ? vol_plugin1->cls : vol_plugin2->cls), lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -496,7 +496,7 @@ H5Lcreate_soft(const char *link_target, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name") /* Create the link through the VOL */ - if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, obj, loc_params, vol_plugin, + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, obj, loc_params, vol_plugin->cls, lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") @@ -599,7 +599,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, /* Create the link through the VOL */ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, obj2, loc_params2, - (vol_plugin1!=NULL ? vol_plugin1 : vol_plugin2), + (vol_plugin1!=NULL ? vol_plugin1->cls : vol_plugin2->cls), lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") @@ -684,7 +684,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") /* Create the link through the VOL */ - if(H5VL_link_create(H5VL_LINK_CREATE_UD, obj, loc_params, vol_plugin, + if(H5VL_link_create(H5VL_LINK_CREATE_UD, obj, loc_params, vol_plugin->cls, lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") @@ -738,7 +738,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Delete the link through the VOL */ - if(H5VL_link_specific(obj, loc_params, vol_plugin, H5VL_LINK_DELETE, + if(H5VL_link_specific(obj, loc_params, vol_plugin->cls, H5VL_LINK_DELETE, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link") @@ -807,7 +807,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Delete the link through the VOL */ - if(H5VL_link_specific(obj, loc_params, vol_plugin, H5VL_LINK_DELETE, + if(H5VL_link_specific(obj, loc_params, vol_plugin->cls, H5VL_LINK_DELETE, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link") @@ -869,7 +869,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the link info through the VOL */ - if(H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_GET_VAL, + if(H5VL_link_get(obj, loc_params, vol_plugin->cls, H5VL_LINK_GET_VAL, H5AC_ind_dxpl_id, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link value") @@ -939,7 +939,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the link info through the VOL */ - if(H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_GET_VAL, + if(H5VL_link_get(obj, loc_params, vol_plugin->cls, H5VL_LINK_GET_VAL, H5AC_ind_dxpl_id, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link value") @@ -994,7 +994,7 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* check link existence through the VOL */ - if(H5VL_link_specific(obj, loc_params, vol_plugin, H5VL_LINK_EXISTS, + if(H5VL_link_specific(obj, loc_params, vol_plugin->cls, H5VL_LINK_EXISTS, H5AC_ind_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link info") @@ -1050,7 +1050,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the link info through the VOL */ - if(H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_GET_INFO, + if(H5VL_link_get(obj, loc_params, vol_plugin->cls, H5VL_LINK_GET_INFO, H5AC_ind_dxpl_id, H5_REQUEST_NULL, linfo) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link info") @@ -1116,7 +1116,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the link info through the VOL */ - if(H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_GET_INFO, + if(H5VL_link_get(obj, loc_params, vol_plugin->cls, H5VL_LINK_GET_INFO, H5AC_ind_dxpl_id, H5_REQUEST_NULL, linfo) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link info") @@ -1312,7 +1312,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the link info through the VOL */ - if(H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_GET_NAME, + if(H5VL_link_get(obj, loc_params, vol_plugin->cls, H5VL_LINK_GET_NAME, H5AC_ind_dxpl_id, H5_REQUEST_NULL, name, size, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link name") @@ -1378,7 +1378,7 @@ H5Literate(hid_t id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* iterate over the links through the VOL */ - if((ret_value = H5VL_link_specific(obj, loc_params, vol_plugin, H5VL_LINK_ITER, + if((ret_value = H5VL_link_specific(obj, loc_params, vol_plugin->cls, H5VL_LINK_ITER, H5AC_ind_dxpl_id, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") @@ -1452,7 +1452,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* iterate over the links through the VOL */ - if((ret_value = H5VL_link_specific(obj, loc_params, vol_plugin, H5VL_LINK_ITER, + if((ret_value = H5VL_link_specific(obj, loc_params, vol_plugin->cls, H5VL_LINK_ITER, H5AC_ind_dxpl_id, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") @@ -1526,7 +1526,7 @@ H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* iterate over the links through the VOL */ - if((ret_value = H5VL_link_specific(obj, loc_params, vol_plugin, H5VL_LINK_ITER, + if((ret_value = H5VL_link_specific(obj, loc_params, vol_plugin->cls, H5VL_LINK_ITER, H5AC_ind_dxpl_id, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visit failed") @@ -1605,7 +1605,7 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* visit the links through the VOL */ - if((ret_value = H5VL_link_specific(obj, loc_params, vol_plugin, H5VL_LINK_ITER, + if((ret_value = H5VL_link_specific(obj, loc_params, vol_plugin->cls, H5VL_LINK_ITER, H5AC_ind_dxpl_id, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visit failed") diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 1947d58..a78b0b0 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -633,7 +633,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") /* Create the link through the VOL */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_UD, obj, loc_params, vol_plugin, + if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_UD, obj, loc_params, vol_plugin->cls, lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") diff --git a/src/H5O.c b/src/H5O.c index 147b682..00103c4 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -253,7 +253,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) loc_params.obj_type = H5I_get_type(loc_id); /* Open the object through the VOL */ - if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin, &opened_type, + if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin->cls, &opened_type, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") @@ -330,7 +330,7 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Open the object through the VOL */ - if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin, &opened_type, + if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin->cls, &opened_type, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") @@ -402,7 +402,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Open the object through the VOL */ - if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin, &opened_type, + if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin->cls, &opened_type, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") @@ -510,7 +510,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, /* Create the link through the VOL */ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, obj2, loc_params2, - (vol_plugin1!=NULL ? vol_plugin1 : vol_plugin2), + (vol_plugin1!=NULL ? vol_plugin1->cls : vol_plugin2->cls), lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") @@ -561,7 +561,7 @@ H5Oincr_refcount(hid_t object_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* change the ref count through the VOL */ - if(H5VL_object_specific(obj, loc_params, vol_plugin, H5VL_OBJECT_CHANGE_REF_COUNT, + if(H5VL_object_specific(obj, loc_params, vol_plugin->cls, H5VL_OBJECT_CHANGE_REF_COUNT, H5AC_dxpl_id, H5_REQUEST_NULL, 1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") @@ -612,7 +612,7 @@ H5Odecr_refcount(hid_t object_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* change the ref count through the VOL */ - if(H5VL_object_specific(obj, loc_params, vol_plugin, H5VL_OBJECT_CHANGE_REF_COUNT, + if(H5VL_object_specific(obj, loc_params, vol_plugin->cls, H5VL_OBJECT_CHANGE_REF_COUNT, H5AC_dxpl_id, H5_REQUEST_NULL, -1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") @@ -667,7 +667,7 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* change the ref count through the VOL */ - if(H5VL_object_specific(obj, loc_params, vol_plugin, H5VL_OBJECT_EXISTS, + if(H5VL_object_specific(obj, loc_params, vol_plugin->cls, H5VL_OBJECT_EXISTS, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) @@ -715,7 +715,7 @@ H5Oget_info(hid_t loc_id, H5O_info_t *oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the group info through the VOL using the location token */ - if(H5VL_object_optional(obj, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + if(H5VL_object_optional(obj, vol_plugin->cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") @@ -773,7 +773,7 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the group info through the VOL using the location token */ - if(H5VL_object_optional(obj, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + if(H5VL_object_optional(obj, vol_plugin->cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") @@ -840,7 +840,7 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the group info through the VOL using the location token */ - if(H5VL_object_optional(obj, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + if(H5VL_object_optional(obj, vol_plugin->cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") @@ -888,7 +888,7 @@ H5Oset_comment(hid_t obj_id, const char *comment) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* set comment on object through the VOL */ - if(H5VL_object_optional(obj, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + if(H5VL_object_optional(obj, vol_plugin->cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to set comment value") @@ -948,7 +948,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* set comment on object through the VOL */ - if(H5VL_object_optional(obj, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + if(H5VL_object_optional(obj, vol_plugin->cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to set comment value") @@ -994,7 +994,7 @@ H5Oget_comment(hid_t loc_id, char *comment, size_t bufsize) if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_object_optional(obj, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + if(H5VL_object_optional(obj, vol_plugin->cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object comment") @@ -1052,7 +1052,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_object_optional(obj, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + if(H5VL_object_optional(obj, vol_plugin->cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object info") @@ -1124,7 +1124,7 @@ H5Ovisit(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* iterate over the objects through the VOL */ - if((ret_value = H5VL_object_specific(obj, loc_params, vol_plugin, H5VL_OBJECT_VISIT, + if((ret_value = H5VL_object_specific(obj, loc_params, vol_plugin->cls, H5VL_OBJECT_VISIT, H5AC_ind_dxpl_id, H5_REQUEST_NULL, idx_type, order, op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") @@ -1207,7 +1207,7 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* iterate over the objects through the VOL */ - if((ret_value = H5VL_object_specific(obj, loc_params, vol_plugin, H5VL_OBJECT_VISIT, + if((ret_value = H5VL_object_specific(obj, loc_params, vol_plugin->cls, H5VL_OBJECT_VISIT, H5AC_ind_dxpl_id, H5_REQUEST_NULL, idx_type, order, op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index f408d80..7ba1c07 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -252,8 +252,8 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, loc_params2.obj_type = H5I_get_type(dst_loc_id); /* Open the object through the VOL */ - if((ret_value = H5VL_object_copy(obj1, loc_params1, vol_plugin1, src_name, - obj2, loc_params2, vol_plugin2, dst_name, + if((ret_value = H5VL_object_copy(obj1, loc_params1, vol_plugin1->cls, src_name, + obj2, loc_params2, vol_plugin2->cls, dst_name, ocpypl_id, lcpl_id, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to copy object") diff --git a/src/H5R.c b/src/H5R.c index f813f93..4adea98 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -381,7 +381,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* create the ref through the VOL */ - if(ret_value = H5VL_object_specific(obj, loc_params, vol_plugin, H5VL_REF_CREATE, + if(ret_value = H5VL_object_specific(obj, loc_params, vol_plugin->cls, H5VL_REF_CREATE, H5AC_dxpl_id, H5_REQUEST_NULL, ref, name, ref_type, space_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") @@ -610,7 +610,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r loc_params.obj_type = H5I_get_type(obj_id); /* Open the object through the VOL */ - if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin, &opened_type, + if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin->cls, &opened_type, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to dereference object") @@ -743,7 +743,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the space id through the VOL */ - if(H5VL_object_get(obj, loc_params, vol_plugin, H5VL_REF_GET_REGION, + if(H5VL_object_get(obj, loc_params, vol_plugin->cls, H5VL_REF_GET_REGION, H5AC_ind_dxpl_id, H5_REQUEST_NULL, &ret_value, ref_type, ref) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") @@ -890,7 +890,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* get the object type through the VOL */ - if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin, H5VL_REF_GET_TYPE, + if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin->cls, H5VL_REF_GET_TYPE, H5AC_ind_dxpl_id, H5_REQUEST_NULL, obj_type, ref_type, ref)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") @@ -1065,7 +1065,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* get the object type through the VOL */ - if(H5VL_object_get(obj, loc_params, vol_plugin, H5VL_REF_GET_NAME, H5AC_dxpl_id, H5_REQUEST_NULL, + if(H5VL_object_get(obj, loc_params, vol_plugin->cls, H5VL_REF_GET_NAME, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value, name, size, ref_type, _ref) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") done: diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 1581168..1f95827 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -185,7 +185,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* get the object type through the VOL */ - if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin, H5VL_REF_GET_TYPE, + if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin->cls, H5VL_REF_GET_TYPE, H5AC_ind_dxpl_id, H5_REQUEST_NULL, &obj_type, ref_type, ref)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") @@ -252,7 +252,7 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) loc_params.obj_type = H5I_get_type(obj_id); /* Open the object through the VOL */ - if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin, &opened_type, + if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin->cls, &opened_type, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open object") diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index efc443d..ed4d37b 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -173,7 +173,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* commit the datatype through the VOL */ - if (NULL == (dt = H5VL_datatype_commit(obj, loc_params, vol_plugin, name, type_id, lcpl_id, + if (NULL == (dt = H5VL_datatype_commit(obj, loc_params, vol_plugin->cls, name, type_id, lcpl_id, tcpl_id, tapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to commit datatype") @@ -186,6 +186,10 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, if (H5I_register_aux(type_id, vol_plugin) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't attach vol info to ID") + vol_plugin->nrefs ++; + if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin") + done: FUNC_LEAVE_API(ret_value) } /* end H5Tcommit2() */ @@ -336,7 +340,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* commite the datatype through the VOL */ - if (NULL == (dt = H5VL_datatype_commit(obj, loc_params, vol_plugin, NULL, type_id, H5P_DEFAULT, + if (NULL == (dt = H5VL_datatype_commit(obj, loc_params, vol_plugin->cls, NULL, type_id, H5P_DEFAULT, tcpl_id, tapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to commit datatype") @@ -347,6 +351,10 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) if (H5I_register_aux(type_id, vol_plugin) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't attach vol info to ID") + vol_plugin->nrefs ++; + if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin") + done: FUNC_LEAVE_API(ret_value) } /* end H5Tcommit_anon() */ @@ -620,7 +628,7 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the datatype through the VOL */ - if(NULL == (dt = H5VL_datatype_open(obj, loc_params, vol_plugin, name, tapl_id, + if(NULL == (dt = H5VL_datatype_open(obj, loc_params, vol_plugin->cls, name, tapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open datatype") @@ -630,7 +638,7 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) done: if (ret_value < 0 && dt) - if(H5VL_datatype_close (dt, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + if(H5VL_datatype_close (dt, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Topen2() */ @@ -694,7 +702,7 @@ H5Tget_create_plist(hid_t dtype_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* get the rest of the plist through the VOL */ - if(H5VL_datatype_get(type, vol_plugin, H5VL_DATATYPE_GET_TCPL, + if(H5VL_datatype_get(type, vol_plugin->cls, H5VL_DATATYPE_GET_TCPL, H5AC_ind_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get datatype") } /* end if */ @@ -959,7 +967,7 @@ H5VL_create_datatype(void *dt_obj, H5VL_t *vol_plugin, hbool_t app_ref) FUNC_ENTER_NOAPI(FAIL) /* get required buf size for encoding the datatype */ - if(H5VL_datatype_get(dt_obj, vol_plugin, H5VL_DATATYPE_GET_BINARY, + if(H5VL_datatype_get(dt_obj, vol_plugin->cls, H5VL_DATATYPE_GET_BINARY, H5AC_dxpl_id, H5_REQUEST_NULL, &nalloc, NULL, 0) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to get datatype serialized size") @@ -968,19 +976,19 @@ H5VL_create_datatype(void *dt_obj, H5VL_t *vol_plugin, hbool_t app_ref) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate space for datatype") /* get binary description of the datatype */ - if(H5VL_datatype_get(dt_obj, vol_plugin, H5VL_DATATYPE_GET_BINARY, + if(H5VL_datatype_get(dt_obj, vol_plugin->cls, H5VL_DATATYPE_GET_BINARY, H5AC_dxpl_id, H5_REQUEST_NULL, &nalloc, buf, (size_t)nalloc) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to get serialized datatype") - if(NULL == (dt = H5T_decode(buf))) + if(NULL == (dt = H5T_decode((const unsigned char *)buf))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't decode datatype") dt->vol_obj = dt_obj; H5MM_free(buf); /* Get an atom for the datatype with the VOL information as the auxilary struct*/ - if((ret_value = H5I_register2(H5I_DATATYPE, dt, vol_plugin, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") + if((ret_value = H5VL_register_id(H5I_DATATYPE, dt, vol_plugin, app_ref)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize datatype handle") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1010,10 +1018,15 @@ H5T_close_datatype(void *type, H5VL_t *vol_plugin) FUNC_ENTER_NOAPI_NOINIT /* Close the datatype through the VOL*/ - if (NULL != dt->vol_obj) - if((ret_value = H5VL_datatype_close(dt->vol_obj, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) + if (NULL != dt->vol_obj) { + if((ret_value = H5VL_datatype_close(dt->vol_obj, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype") + /* decrement ref count on VOL ID */ + if(H5VL_free_id(vol_plugin) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin") + } + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_close_datatype() */ diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index addbdfe..51c55f4 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -178,7 +178,7 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* commit the datatype through the VOL */ - if (NULL == (dt = H5VL_datatype_commit(obj, loc_params, vol_plugin, name, type_id, + if (NULL == (dt = H5VL_datatype_commit(obj, loc_params, vol_plugin->cls, name, type_id, H5P_LINK_CREATE_DEFAULT, H5P_DATATYPE_CREATE_DEFAULT, H5P_DATATYPE_ACCESS_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to commit datatype") @@ -192,6 +192,10 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) if (H5I_register_aux(type_id, vol_plugin) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't attach vol info to ID") + vol_plugin->nrefs ++; + if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin") + done: FUNC_LEAVE_API(ret_value) } /* end H5Tcommit1() */ @@ -240,7 +244,7 @@ H5Topen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the datatype through the VOL */ - if(NULL == (dt = H5VL_datatype_open(obj, loc_params, vol_plugin, name, + if(NULL == (dt = H5VL_datatype_open(obj, loc_params, vol_plugin->cls, name, H5P_DATATYPE_ACCESS_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open datatype") @@ -250,7 +254,7 @@ H5Topen1(hid_t loc_id, const char *name) done: if (ret_value < 0 && dt) - if(H5VL_datatype_close (dt, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + if(H5VL_datatype_close (dt, vol_plugin->cls, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Topen1() */ diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 217a0d6..3722af8 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -141,7 +141,6 @@ H5_DLL herr_t H5T_set_latest_version(H5T_t *dt); H5_DLL herr_t H5T_patch_file(H5T_t *dt, H5F_t *f); H5_DLL htri_t H5T_is_variable_str(const H5T_t *dt); H5_DLL void * H5T_get_named_type(const H5T_t *dt); -H5_DLL hid_t H5VL_create_datatype(void *dt_obj, H5VL_t *vol_plugin, hbool_t app_ref); H5_DLL herr_t H5T_set_vol_object(H5T_t *type, void *vol_obj); /* Reference specific functions */ diff --git a/src/H5VL.c b/src/H5VL.c index 485bc57..aa0775a 100644 --- a/src/H5VL.c +++ b/src/H5VL.c @@ -52,9 +52,9 @@ static herr_t H5VL_free_cls(H5VL_class_t *cls); /* Local Variables */ /*******************/ typedef struct { - const H5VL_class_t *vol_cls; + const char *name; hid_t ret_id; -} H5VL_is_registered_ud_t; +} H5VL_get_plugin_ud_t; /* VOL ID class */ static const H5I_class_t H5I_VOL_CLS[1] = {{ @@ -306,6 +306,7 @@ H5VLinitialize(hid_t plugin_id, hid_t vipl_id) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ii", plugin_id, vipl_id); /* Check args */ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) @@ -338,6 +339,7 @@ H5VLterminate(hid_t plugin_id, hid_t vtpl_id) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ii", plugin_id, vtpl_id); /* Check args */ if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) @@ -367,21 +369,21 @@ done: *------------------------------------------------------------------------- */ static int -H5VL__is_registered_cb(void *obj, hid_t id, void *_op_data) +H5VL__get_plugin_cb(void *obj, hid_t id, void *_op_data) { - H5VL_is_registered_ud_t *op_data = (H5VL_is_registered_ud_t *)_op_data; /* User data for callback */ + H5VL_get_plugin_ud_t *op_data = (H5VL_get_plugin_ud_t *)_op_data; /* User data for callback */ H5VL_class_t *cls = (H5VL_class_t *)obj; - int ret_value; /* Callback return value */ + int ret_value = H5_ITER_CONT; /* Callback return value */ FUNC_ENTER_STATIC_NOERR - if(cls->value == op_data->vol_cls->value) { + if(0 == strcmp(cls->name, op_data->name)) { op_data->ret_id = id; ret_value = H5_ITER_STOP; } FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL__is_registered_cb() */ +} /* end H5VL__get_plugin_cb() */ /*------------------------------------------------------------------------- @@ -399,19 +401,19 @@ H5VL__is_registered_cb(void *obj, hid_t id, void *_op_data) *------------------------------------------------------------------------- */ htri_t -H5VLis_registered(const H5VL_class_t *cls) +H5VLis_registered(const char *name) { - H5VL_is_registered_ud_t op_data; + H5VL_get_plugin_ud_t op_data; htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE1("t", "*x", cls); + H5TRACE1("t", "*s", name); op_data.ret_id = FAIL; - op_data.vol_cls = cls; + op_data.name = name; /* Check arguments */ - if(H5I_iterate(H5I_VOL, H5VL__is_registered_cb, &op_data, TRUE) < 0) + if(H5I_iterate(H5I_VOL, H5VL__get_plugin_cb, &op_data, TRUE) < 0) HGOTO_ERROR(H5E_VOL, H5E_BADITER, FAIL, "can't iterate over VOL ids") if(op_data.ret_id != FAIL) @@ -436,18 +438,19 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VLget_plugin_id(const H5VL_class_t *cls) +H5VLget_plugin_id(const char *name) { - H5VL_is_registered_ud_t op_data; + H5VL_get_plugin_ud_t op_data; hid_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) + H5TRACE1("i", "*s", name); op_data.ret_id = FAIL; - op_data.vol_cls = cls; + op_data.name = name; /* Check arguments */ - if(H5I_iterate(H5I_VOL, H5VL__is_registered_cb, &op_data, TRUE) < 0) + if(H5I_iterate(H5I_VOL, H5VL__get_plugin_cb, &op_data, TRUE) < 0) HGOTO_ERROR(H5E_VOL, H5E_BADITER,FAIL, "can't iterate over VOL ids") if(op_data.ret_id != FAIL) { @@ -477,14 +480,14 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5VLget_plugin_name(hid_t id, char *name/*out*/, size_t size) +H5VLget_plugin_name(hid_t obj_id, char *name/*out*/, size_t size) { ssize_t ret_value; FUNC_ENTER_API(FAIL) - H5TRACE3("Zs", "ixz", id, name, size); + H5TRACE3("Zs", "ixz", obj_id, name, size); - if((ret_value = H5VL_get_plugin_name(id, name, size)) < 0) + if((ret_value = H5VL_get_plugin_name(obj_id, name, size)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Can't get plugin name") done: @@ -511,9 +514,10 @@ H5VLclose(hid_t vol_id) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) + H5TRACE1("e", "i", vol_id); /* Check args */ - if(NULL == H5I_object_verify(vol_id,H5I_VOL)) + if(NULL == H5I_object_verify(vol_id, H5I_VOL)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(H5I_dec_app_ref(vol_id) < 0) @@ -538,19 +542,25 @@ done: *--------------------------------------------------------------------------- */ hid_t -H5VLobject_register(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls) +H5VLobject_register(void *obj, H5I_type_t obj_type, hid_t plugin_id) { H5VL_t *vol_plugin; /* VOL plugin information */ + H5VL_class_t *vol_cls = NULL; hid_t ret_value = FAIL; FUNC_ENTER_API(FAIL) - H5TRACE3("i", "*xIt*x", obj, obj_type, cls); + H5TRACE3("i", "*xIti", obj, obj_type, plugin_id); + + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object to register") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Build the vol plugin struct */ if(NULL == (vol_plugin = (H5VL_t *)H5MM_calloc(sizeof(H5VL_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - vol_plugin->cls = cls; - vol_plugin->nrefs = 1; + vol_plugin->cls = vol_cls; + vol_plugin->id = plugin_id; if ((ret_value = H5VL_object_register(obj, obj_type, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") @@ -575,29 +585,25 @@ done: *--------------------------------------------------------------------------- */ herr_t -H5VLget_object(hid_t obj_id, void **obj, H5VL_t **vol_plugin) +H5VLget_object(hid_t obj_id, void **obj) { - H5VL_t *temp_vol; + H5VL_t *vol_plugin; hid_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i**x**x", obj_id, obj, vol_plugin); + H5TRACE2("e", "i**x", obj_id, obj); /* Check args */ if(!obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object pointer") /* get the plugin pointer */ - if (NULL == (temp_vol = (H5VL_t *)H5I_get_aux(obj_id))) + if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(NATIVE == temp_vol->cls->value) + if(NATIVE == vol_plugin->cls->value) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "cannot call public function on library type") - /* if the user requested the plugin pointer, return it */ - if(vol_plugin) - *vol_plugin = temp_vol; - if(NULL == (*obj = H5VL_get_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain a valid object") @@ -620,16 +626,21 @@ done: *------------------------------------------------------------------------- */ void * -H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, +H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) { - void *ret_value = NULL; /* Return value */ + H5VL_class_t *vol_cls = NULL; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") - if(NULL == (ret_value = H5VL_attr_create(obj, loc_params, vol_plugin, name, acpl_id, aapl_id, dxpl_id, req))) + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + if(NULL == (ret_value = H5VL_attr_create(obj, loc_params, vol_cls, name, + acpl_id, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create attribute") done: @@ -651,16 +662,21 @@ done: *------------------------------------------------------------------------- */ void * -H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, +H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req) { - void *ret_value; /* Return value */ + H5VL_class_t *vol_cls = NULL; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") - if(NULL == (ret_value = H5VL_attr_open(obj, loc_params, vol_plugin, name, aapl_id, dxpl_id, req))) + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + if(NULL == (ret_value = H5VL_attr_open(obj, loc_params, vol_cls, name, aapl_id, + dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open attribute") done: @@ -682,15 +698,19 @@ done: * *------------------------------------------------------------------------- */ -herr_t H5VLattr_read(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) +herr_t H5VLattr_read(void *attr, hid_t plugin_id, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) { + H5VL_class_t *vol_cls = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - if (NULL == attr || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_attr_read(attr, vol_plugin, mem_type_id, buf, dxpl_id, req)) < 0) + if (NULL == attr) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + if((ret_value = H5VL_attr_read(attr, vol_cls, mem_type_id, buf, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read attribute") done: @@ -711,15 +731,19 @@ done: * *------------------------------------------------------------------------- */ -herr_t H5VLattr_write(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req) +herr_t H5VLattr_write(void *attr, hid_t plugin_id, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req) { + H5VL_class_t *vol_cls = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - if (NULL == attr || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_attr_write(attr, vol_plugin, mem_type_id, buf, dxpl_id, req)) < 0) + if (NULL == attr) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + if((ret_value = H5VL_attr_write(attr, vol_cls, mem_type_id, buf, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write attribute") done: @@ -741,21 +765,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_get(void *obj, H5VL_t *vol_plugin, H5VL_attr_get_t get_type, +H5VLattr_get(void *obj, hid_t plugin_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVai**xx", obj, vol_plugin, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVai**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ - if(NULL == vol_plugin->cls->attr_cls.get) + if(NULL == vol_cls->attr_cls.get) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr get' method") - if((ret_value = (vol_plugin->cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to get attribute information") done: @@ -777,22 +804,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, +H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xx*xVbi**xx", obj, loc_params, vol_plugin, specific_type, + H5TRACE7("e", "*xxiVbi**xx", obj, loc_params, plugin_id, specific_type, dxpl_id, req, arguments); - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ - if(NULL == vol_plugin->cls->attr_cls.specific) + if(NULL == vol_cls->attr_cls.specific) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr specific' method") - if((ret_value = (vol_plugin->cls->attr_cls.specific) + if((ret_value = (vol_cls->attr_cls.specific) (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") @@ -815,20 +845,23 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments) +H5VLattr_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*x*xi**xx", obj, vol_plugin, dxpl_id, req, arguments); + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Have to bypass the H5VLint layer due to unknown val_list arguments */ - if(NULL == vol_plugin->cls->attr_cls.optional) + if(NULL == vol_cls->attr_cls.optional) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr optional' method") - if((ret_value = (vol_plugin->cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") done: @@ -850,16 +883,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_close(void *attr, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) +H5VLattr_close(void *attr, hid_t plugin_id, hid_t dxpl_id, void **req) { + H5VL_class_t *vol_cls = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*x*xi**x", attr, vol_plugin, dxpl_id, req); + H5TRACE4("e", "*xii**x", attr, plugin_id, dxpl_id, req); - if (NULL == attr || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_attr_close(attr, vol_plugin, dxpl_id, req)) < 0) + if (NULL == attr) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + if((ret_value = H5VL_attr_close(attr, vol_cls, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close attribute") done: @@ -881,16 +918,20 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, +H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req) { - void *ret_value = NULL; /* Return value */ + H5VL_class_t *vol_cls = NULL; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") - if(NULL == (ret_value = H5VL_datatype_commit(obj, loc_params, vol_plugin, name, type_id, + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + if(NULL == (ret_value = H5VL_datatype_commit(obj, loc_params, vol_cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to commit datatype") @@ -913,16 +954,21 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, +H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) { - void *ret_value = NULL; /* Return value */ + H5VL_class_t *vol_cls = NULL; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") - if(NULL == (ret_value = H5VL_datatype_open(obj, loc_params, vol_plugin, name, tapl_id, dxpl_id, req))) + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + if(NULL == (ret_value = H5VL_datatype_open(obj, loc_params, vol_cls, name, + tapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open datatype") done: @@ -944,21 +990,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_specific(void *obj, H5VL_t *vol_plugin, H5VL_datatype_specific_t specific_type, +H5VLdatatype_specific(void *obj, hid_t plugin_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVfi**xx", obj, vol_plugin, specific_type, dxpl_id, req, + H5TRACE6("e", "*xiVfi**xx", obj, plugin_id, specific_type, dxpl_id, req, arguments); - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if(NULL == vol_plugin->cls->datatype_cls.specific) + if(NULL == vol_cls->datatype_cls.specific) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `datatype specific' method") - if((ret_value = (vol_plugin->cls->datatype_cls.specific) + if((ret_value = (vol_cls->datatype_cls.specific) (obj, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback") @@ -981,19 +1030,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments) +H5VLdatatype_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*x*xi**xx", obj, vol_plugin, dxpl_id, req, arguments); + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if(NULL == vol_plugin->cls->datatype_cls.optional) + if(NULL == vol_cls->datatype_cls.optional) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `datatype optional' method") - if((ret_value = (vol_plugin->cls->datatype_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->datatype_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback") done: @@ -1015,21 +1067,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_get(void *obj, H5VL_t *vol_plugin, H5VL_datatype_get_t get_type, +H5VLdatatype_get(void *obj, hid_t plugin_id, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVei**xx", obj, vol_plugin, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVei**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); - if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ - if(NULL == vol_plugin->cls->datatype_cls.get) + if(NULL == vol_cls->datatype_cls.get) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `datatype get' method") - if((ret_value = (vol_plugin->cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute datatype get callback") done: @@ -1051,16 +1106,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_close(void *dt, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) +H5VLdatatype_close(void *dt, hid_t plugin_id, hid_t dxpl_id, void **req) { - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*x*xi**x", dt, vol_plugin, dxpl_id, req); + H5TRACE4("e", "*xii**x", dt, plugin_id, dxpl_id, req); - if (NULL == dt || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_datatype_close(dt, vol_plugin, dxpl_id, req)) < 0) + if (NULL == dt) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + if((ret_value = H5VL_datatype_close(dt, vol_cls, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close datatype") done: @@ -1082,16 +1141,20 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, +H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) { - void *ret_value; /* Return value */ + H5VL_class_t *vol_cls = NULL; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") - if(NULL == (ret_value = H5VL_dataset_create(obj, loc_params, vol_plugin, name, + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + if(NULL == (ret_value = H5VL_dataset_create(obj, loc_params, vol_cls, name, dcpl_id, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create dataset") @@ -1114,16 +1177,20 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, +H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) { - void *ret_value; /* Return value */ + H5VL_class_t *vol_cls = NULL; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") - if(NULL == (ret_value = H5VL_dataset_open(obj, loc_params, vol_plugin, name, dapl_id, dxpl_id, req))) + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + if(NULL == (ret_value = H5VL_dataset_open(obj, loc_params, vol_cls, name, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open dataset") done: @@ -1145,18 +1212,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_read(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, +H5VLdataset_read(void *dset, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req) { + H5VL_class_t *vol_cls = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE8("e", "*x*xiiii*x**x", dset, vol_plugin, mem_type_id, mem_space_id, + H5TRACE8("e", "*xiiiii*x**x", dset, plugin_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); - if (NULL == dset || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_dataset_read(dset, vol_plugin, mem_type_id, mem_space_id, file_space_id, + if (NULL == dset) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + if((ret_value = H5VL_dataset_read(dset, vol_cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset") @@ -1179,18 +1250,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_write(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, +H5VLdataset_write(void *dset, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req) { + H5VL_class_t *vol_cls = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE8("e", "*x*xiiii*x**x", dset, vol_plugin, mem_type_id, mem_space_id, + H5TRACE8("e", "*xiiiii*x**x", dset, plugin_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); - if (NULL == dset || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_dataset_write(dset, vol_plugin, mem_type_id, mem_space_id, file_space_id, + if (NULL == dset) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + if((ret_value = H5VL_dataset_write(dset, vol_cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset") @@ -1213,22 +1288,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_get(void *dset, H5VL_t *vol_plugin, H5VL_dataset_get_t get_type, +H5VLdataset_get(void *dset, hid_t plugin_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVci**xx", dset, vol_plugin, get_type, dxpl_id, req, - arguments); + H5TRACE6("e", "*xiVci**xx", dset, plugin_id, get_type, dxpl_id, req, arguments); - if (NULL == dset || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if (NULL == dset) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ - if(NULL == vol_plugin->cls->dataset_cls.get) + if(NULL == vol_cls->dataset_cls.get) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dataset get' method") - if((ret_value = (vol_plugin->cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute dataset get callback") done: @@ -1250,21 +1327,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_specific(void *obj, H5VL_t *vol_plugin, H5VL_dataset_specific_t specific_type, +H5VLdataset_specific(void *obj, hid_t plugin_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVdi**xx", obj, vol_plugin, specific_type, dxpl_id, req, + H5TRACE6("e", "*xiVdi**xx", obj, plugin_id, specific_type, dxpl_id, req, arguments); - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if(NULL == vol_plugin->cls->dataset_cls.specific) + if(NULL == vol_cls->dataset_cls.specific) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dataset specific' method") - if((ret_value = (vol_plugin->cls->dataset_cls.specific) + if((ret_value = (vol_cls->dataset_cls.specific) (obj, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset specific callback") @@ -1287,19 +1367,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments) +H5VLdataset_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*x*xi**xx", obj, vol_plugin, dxpl_id, req, arguments); + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if(NULL == vol_plugin->cls->dataset_cls.optional) + if(NULL == vol_cls->dataset_cls.optional) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dataset optional' method") - if((ret_value = (vol_plugin->cls->dataset_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->dataset_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback") done: @@ -1321,16 +1404,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_close(void *dset, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) +H5VLdataset_close(void *dset, hid_t plugin_id, hid_t dxpl_id, void **req) { + H5VL_class_t *vol_cls = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*x*xi**x", dset, vol_plugin, dxpl_id, req); + H5TRACE4("e", "*xii**x", dset, plugin_id, dxpl_id, req); + + if (NULL == dset) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if (NULL == dset || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_dataset_close(dset, vol_plugin, dxpl_id, req)) < 0) + if((ret_value = H5VL_dataset_close(dset, vol_cls, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close dataset") done: @@ -1352,14 +1439,27 @@ done: *------------------------------------------------------------------------- */ void * -H5VLfile_create(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fcpl_id, - hid_t fapl_id, hid_t dxpl_id, void **req) +H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, + hid_t dxpl_id, void **req) { - void *ret_value; /* Return value */ + H5P_genplist_t *plist; /* Property list pointer */ + hid_t plugin_id; /* VOL plugin identigier attached to fapl_id */ + H5VL_class_t *vol_cls = NULL; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) - if(NULL == (ret_value = H5VL_file_create(vol_plugin, name, flags, fcpl_id, fapl_id, dxpl_id, req))) + /* get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + if(H5P_get(plist, H5F_ACS_VOL_ID_NAME, &plugin_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol plugin ID") + + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + if(NULL == (ret_value = H5VL_file_create(vol_cls, name, flags, fcpl_id, fapl_id, + dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create file") done: @@ -1381,13 +1481,25 @@ done: *------------------------------------------------------------------------- */ void * -H5VLfile_open(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req) +H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req) { - void *ret_value; /* Return value */ + H5P_genplist_t *plist; /* Property list pointer */ + hid_t plugin_id; /* VOL plugin id attached to fapl_id */ + H5VL_class_t *vol_cls = NULL; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) - if(NULL == (ret_value = H5VL_file_open(vol_plugin, name, flags, fapl_id, dxpl_id, req))) + /* get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + if(H5P_get(plist, H5F_ACS_VOL_ID_NAME, &plugin_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol plugin ID") + + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + if(NULL == (ret_value = H5VL_file_open(vol_cls, name, flags, fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create file") done: @@ -1409,22 +1521,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_get(void *file, H5VL_t *vol_plugin, H5VL_file_get_t get_type, +H5VLfile_get(void *file, hid_t plugin_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVgi**xx", file, vol_plugin, get_type, dxpl_id, req, - arguments); + H5TRACE6("e", "*xiVgi**xx", file, plugin_id, get_type, dxpl_id, req, arguments); - if(NULL == file || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if(NULL == file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ - if(NULL == vol_plugin->cls->file_cls.get) + if(NULL == vol_cls->file_cls.get) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file get' method") - if((ret_value = (vol_plugin->cls->file_cls.get)(file, get_type, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->file_cls.get)(file, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute file get callback") done: @@ -1446,19 +1560,19 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_specific(void *file, H5VL_t *vol_plugin, H5VL_file_specific_t specific_type, +H5VLfile_specific(void *file, hid_t plugin_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVhi**xx", file, vol_plugin, specific_type, dxpl_id, req, + H5TRACE6("e", "*xiVhi**xx", file, plugin_id, specific_type, dxpl_id, req, arguments); if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { H5P_genplist_t *plist; /* Property list pointer */ hid_t vol_id; /* VOL plugin identigier attached to fapl_id */ - H5VL_class_t *vol_cls; /* VOL class of vol_id */ hid_t fapl_id; fapl_id = va_arg (arguments, hid_t); @@ -1477,12 +1591,14 @@ H5VLfile_specific(void *file, H5VL_t *vol_plugin, H5VL_file_specific_t specific_ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") } else { - if(NULL == file || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if(NULL == file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if(NULL == vol_plugin->cls->file_cls.specific) + if(NULL == vol_cls->file_cls.specific) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file specific' method") - if((ret_value = (vol_plugin->cls->file_cls.specific) + if((ret_value = (vol_cls->file_cls.specific) (file, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file specific callback") } @@ -1505,19 +1621,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_optional(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments) +H5VLfile_optional(void *file, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*x*xi**xx", file, vol_plugin, dxpl_id, req, arguments); + H5TRACE5("e", "*xii**xx", file, plugin_id, dxpl_id, req, arguments); - if(NULL == file || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if(NULL == file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if(NULL == vol_plugin->cls->file_cls.optional) + if(NULL == vol_cls->file_cls.optional) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file optional' method") - if((ret_value = (vol_plugin->cls->file_cls.optional)(file, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->file_cls.optional)(file, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file optional callback") done: @@ -1539,16 +1658,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_close(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) +H5VLfile_close(void *file, hid_t plugin_id, hid_t dxpl_id, void **req) { + H5VL_class_t *vol_cls = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*x*xi**x", file, vol_plugin, dxpl_id, req); + H5TRACE4("e", "*xii**x", file, plugin_id, dxpl_id, req); + + if(NULL == file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if(NULL == file || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_file_close(file, vol_plugin, dxpl_id, req)) < 0) + if((ret_value = H5VL_file_close(file, vol_cls, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close file") done: @@ -1570,16 +1693,20 @@ done: *------------------------------------------------------------------------- */ void * -H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, +H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) { + H5VL_class_t *vol_cls = NULL; void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") - if(NULL == (ret_value = H5VL_group_create(obj, loc_params, vol_plugin, name, + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + if(NULL == (ret_value = H5VL_group_create(obj, loc_params, vol_cls, name, gcpl_id, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create group") @@ -1602,16 +1729,20 @@ done: *------------------------------------------------------------------------- */ void * -H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, +H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req) { - void *ret_value; /* Return value */ + H5VL_class_t *vol_cls = NULL; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") - if(NULL == (ret_value = H5VL_group_open(obj, loc_params, vol_plugin, name, + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + if(NULL == (ret_value = H5VL_group_open(obj, loc_params, vol_cls, name, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group") @@ -1634,21 +1765,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_get(void *obj, H5VL_t *vol_plugin, H5VL_group_get_t get_type, +H5VLgroup_get(void *obj, hid_t plugin_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVii**xx", obj, vol_plugin, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*xiVii**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); - if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ - if(NULL == vol_plugin->cls->group_cls.get) + if(NULL == vol_cls->group_cls.get) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `group get' method") - if((ret_value = (vol_plugin->cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute group get callback") done: @@ -1670,21 +1804,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_specific(void *obj, H5VL_t *vol_plugin, H5VL_group_specific_t specific_type, +H5VLgroup_specific(void *obj, hid_t plugin_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVji**xx", obj, vol_plugin, specific_type, dxpl_id, req, + H5TRACE6("e", "*xiVji**xx", obj, plugin_id, specific_type, dxpl_id, req, arguments); - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if(NULL == vol_plugin->cls->group_cls.specific) + if(NULL == vol_cls->group_cls.specific) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `group specific' method") - if((ret_value = (vol_plugin->cls->group_cls.specific) + if((ret_value = (vol_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") @@ -1707,19 +1844,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_optional(void *obj, H5VL_t *vol_plugin, 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) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*x*xi**xx", obj, vol_plugin, dxpl_id, req, arguments); + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if(NULL == vol_plugin->cls->group_cls.optional) + if(NULL == vol_cls->group_cls.optional) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `group optional' method") - if((ret_value = (vol_plugin->cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") done: @@ -1741,16 +1881,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_close(void *grp, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) +H5VLgroup_close(void *grp, hid_t plugin_id, hid_t dxpl_id, void **req) { + H5VL_class_t *vol_cls = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*x*xi**x", grp, vol_plugin, dxpl_id, req); + H5TRACE4("e", "*xii**x", grp, plugin_id, dxpl_id, req); - if(NULL == grp || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_group_close(grp, vol_plugin, dxpl_id, req)) < 0) + if(NULL == grp) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + if((ret_value = H5VL_group_close(grp, vol_cls, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close group") done: @@ -1772,17 +1916,21 @@ done: */ herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, - H5VL_t *vol_plugin, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) + hid_t plugin_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE8("e", "Vk*xx*xiii**x", create_type, obj, loc_params, vol_plugin, - lcpl_id, lapl_id, dxpl_id, req); + H5TRACE8("e", "Vk*xxiiii**x", create_type, obj, loc_params, plugin_id, lcpl_id, + lapl_id, dxpl_id, req); - if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_link_create(create_type, obj, loc_params, vol_plugin, lcpl_id, lapl_id, dxpl_id, req)) < 0) + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + if((ret_value = H5VL_link_create(create_type, obj, loc_params, vol_cls, lcpl_id, lapl_id, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -1802,18 +1950,25 @@ done: * *------------------------------------------------------------------------- */ -H5_DLL herr_t H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin, - hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +herr_t +H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, hid_t plugin_id, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) + H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2, + plugin_id, lcpl_id, lapl_id, dxpl_id, req); + + if(NULL == src_obj || NULL == dst_obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if(NULL == src_obj || NULL == dst_obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_link_copy(src_obj, loc_params1, dst_obj, loc_params2, vol_plugin, - lcpl_id, lapl_id, dxpl_id, req)) < 0) + if((ret_value = H5VL_link_copy(src_obj, loc_params1, dst_obj, loc_params2, vol_cls, + lcpl_id, lapl_id, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to copy object") done: @@ -1833,17 +1988,24 @@ done: * *------------------------------------------------------------------------- */ -H5_DLL herr_t H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin, - hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +herr_t +H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, hid_t plugin_id, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) + H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2, + plugin_id, lcpl_id, lapl_id, dxpl_id, req); - if(NULL == src_obj || NULL == dst_obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_link_move(src_obj, loc_params1, dst_obj, loc_params2, vol_plugin, + if(NULL == src_obj || NULL == dst_obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + if((ret_value = H5VL_link_move(src_obj, loc_params1, dst_obj, loc_params2, vol_cls, lcpl_id, lapl_id, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to move object") @@ -1867,21 +2029,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_link_get_t get_type, +H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xx*xVli**xx", obj, loc_params, vol_plugin, get_type, dxpl_id, - req, arguments); + H5TRACE7("e", "*xxiVli**xx", obj, loc_params, plugin_id, get_type, dxpl_id, req, + arguments); - if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if(NULL == vol_plugin->cls->link_cls.get) + if(NULL == vol_cls->link_cls.get) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link get' method") - if((ret_value = (vol_plugin->cls->link_cls.get) + if((ret_value = (vol_cls->link_cls.get) (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link get callback") @@ -1904,22 +2069,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, +H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xx*xVmi**xx", obj, loc_params, vol_plugin, specific_type, + H5TRACE7("e", "*xxiVmi**xx", obj, loc_params, plugin_id, specific_type, dxpl_id, req, arguments); - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ - if(NULL == vol_plugin->cls->link_cls.specific) + if(NULL == vol_cls->link_cls.specific) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link specific' method") - if((ret_value = (vol_plugin->cls->link_cls.specific) + if((ret_value = (vol_cls->link_cls.specific) (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") @@ -1942,20 +2110,23 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments) +H5VLlink_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*x*xi**xx", obj, vol_plugin, dxpl_id, req, arguments); + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Have to bypass the H5VLint layer due to unknown val_list arguments */ - if(NULL == vol_plugin->cls->link_cls.optional) + if(NULL == vol_cls->link_cls.optional) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link optional' method") - if((ret_value = (vol_plugin->cls->link_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->link_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") done: @@ -1977,16 +2148,20 @@ done: *------------------------------------------------------------------------- */ void * -H5VLobject_open(void *obj, H5VL_loc_params_t params, H5VL_t *vol_plugin, H5I_type_t *opened_type, +H5VLobject_open(void *obj, H5VL_loc_params_t params, hid_t plugin_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req) { - void *ret_value; /* Return value */ + H5VL_class_t *vol_cls = NULL; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") - if(NULL == (ret_value = H5VL_object_open(obj, params, vol_plugin, opened_type, dxpl_id, req))) + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + if(NULL == (ret_value = H5VL_object_open(obj, params, vol_cls, opened_type, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create group") done: @@ -2008,22 +2183,28 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, H5VL_t *vol_plugin1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin2, const char *dst_name, +H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, hid_t plugin_id1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t plugin_id2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) { + H5VL_class_t *vol_cls1 = NULL; + H5VL_class_t *vol_cls2 = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE12("e", "*xx*x*s*xx*x*siii**x", src_obj, loc_params1, vol_plugin1, - src_name, dst_obj, loc_params2, vol_plugin2, dst_name, ocpypl_id, + H5TRACE12("e", "*xxi*s*xxi*siii**x", src_obj, loc_params1, plugin_id1, + src_name, dst_obj, loc_params2, plugin_id2, dst_name, ocpypl_id, lcpl_id, dxpl_id, req); - if(NULL == src_obj || NULL == dst_obj || NULL == vol_plugin1 || - NULL == vol_plugin2 || NULL == vol_plugin1->cls || NULL == vol_plugin2->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_object_copy(src_obj, loc_params1, vol_plugin1, src_name, - dst_obj, loc_params2, vol_plugin2, dst_name, + if(NULL == src_obj || NULL == dst_obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls1 = (H5VL_class_t *)H5I_object_verify(plugin_id1, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (vol_cls2 = (H5VL_class_t *)H5I_object_verify(plugin_id2, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + if((ret_value = H5VL_object_copy(src_obj, loc_params1, vol_cls1, src_name, + dst_obj, loc_params2, vol_cls2, dst_name, ocpypl_id, lcpl_id, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to move object") @@ -2047,21 +2228,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_get_t get_type, +H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xx*xVni**xx", obj, loc_params, vol_plugin, get_type, dxpl_id, - req, arguments); + H5TRACE7("e", "*xxiVni**xx", obj, loc_params, plugin_id, get_type, dxpl_id, req, + arguments); - if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if(NULL == vol_plugin->cls->object_cls.get) + if(NULL == vol_cls->object_cls.get) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object get' method") - if((ret_value = (vol_plugin->cls->object_cls.get) + if((ret_value = (vol_cls->object_cls.get) (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object get callback") @@ -2084,22 +2268,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, +H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xx*xVoi**xx", obj, loc_params, vol_plugin, specific_type, + H5TRACE7("e", "*xxiVoi**xx", obj, loc_params, plugin_id, specific_type, dxpl_id, req, arguments); - if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ - if(NULL == vol_plugin->cls->object_cls.specific) + if(NULL == vol_cls->object_cls.specific) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object specific' method") - if((ret_value = (vol_plugin->cls->object_cls.specific) + if((ret_value = (vol_cls->object_cls.specific) (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object specific callback") @@ -2122,20 +2309,23 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments) +H5VLobject_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + H5VL_class_t *vol_cls = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*x*xi**xx", obj, vol_plugin, dxpl_id, req, arguments); + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if (NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Have to bypass the H5VLint layer due to unknown val_list arguments */ - if(NULL == vol_plugin->cls->object_cls.optional) + if(NULL == vol_cls->object_cls.optional) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object optional' method") - if((ret_value = (vol_plugin->cls->object_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->object_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback") done: @@ -2157,16 +2347,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_cancel(void **req, H5VL_t *vol_plugin, H5ES_status_t *status) +H5VLrequest_cancel(void **req, hid_t plugin_id, H5ES_status_t *status) { + H5VL_class_t *vol_cls = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE3("e", "**x*x*Es", req, vol_plugin, status); + H5TRACE3("e", "**xi*Es", req, plugin_id, status); + + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if(NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request/VOL class pointer") - if((ret_value = H5VL_request_cancel(req, vol_plugin, status)) < 0) + if((ret_value = H5VL_request_cancel(req, vol_cls, status)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to cancel request") done: @@ -2188,16 +2380,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_test(void **req, H5VL_t *vol_plugin, H5ES_status_t *status) +H5VLrequest_test(void **req, hid_t plugin_id, H5ES_status_t *status) { + H5VL_class_t *vol_cls = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE3("e", "**x*x*Es", req, vol_plugin, status); + H5TRACE3("e", "**xi*Es", req, plugin_id, status); - if(NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request/VOL class pointer") - if((ret_value = H5VL_request_test(req, vol_plugin, status)) < 0) + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + if((ret_value = H5VL_request_test(req, vol_cls, status)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to test request") done: @@ -2219,16 +2413,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_wait(void **req, H5VL_t *vol_plugin, H5ES_status_t *status) +H5VLrequest_wait(void **req, hid_t plugin_id, H5ES_status_t *status) { + H5VL_class_t *vol_cls = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE3("e", "**x*x*Es", req, vol_plugin, status); + H5TRACE3("e", "**xi*Es", req, plugin_id, status); + + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if(NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request/VOL class pointer") - if((ret_value = H5VL_request_wait(req, vol_plugin, status)) < 0) + if((ret_value = H5VL_request_wait(req, vol_cls, status)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to wait on request") done: diff --git a/src/H5VLint.c b/src/H5VLint.c index bfdd35e..ecb95f4 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -119,6 +119,76 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL_register_id + * + * Purpose: Wrapper to register an object ID with a VOL aux struct + * and increment ref count on VOL plugin ID + * + * Return: Success: Positive Identifier + * Failure: A negative value. + * + * Programmer: Mohamad Chaarawi + * August, 2014 + *------------------------------------------------------------------------- + */ +hid_t +H5VL_register_id(H5I_type_t type, const void *object, H5VL_t *vol_plugin, hbool_t app_ref) +{ + hid_t ret_value = FAIL; + + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ + HDassert(object); + HDassert(vol_plugin); + + if((ret_value = H5I_register2(type, object, vol_plugin, app_ref)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize handle") + + vol_plugin->nrefs ++; + if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_register_id() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_free_id + * + * Purpose: Wrapper to register an object ID with a VOL aux struct + * and increment ref count on VOL plugin ID + * + * Return: Success: Positive Identifier + * Failure: A negative value. + * + * Programmer: Mohamad Chaarawi + * August, 2014 + *------------------------------------------------------------------------- + */ +hid_t +H5VL_free_id(H5VL_t *vol_plugin) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(SUCCEED) + + /* Check arguments */ + HDassert(vol_plugin); + + vol_plugin->nrefs --; + if(H5I_dec_ref(vol_plugin->id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin") + if (0 == vol_plugin->nrefs) + vol_plugin = (H5VL_t *)H5MM_xfree(vol_plugin); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_free_id() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_fapl_open * * Purpose: Mark a vol as used by a file access property list @@ -320,22 +390,22 @@ H5VL_object_register(void *obj, H5I_type_t obj_type, H5VL_t *vol_plugin, hbool_t /* Get an atom for the object and attach VOL information and free function to the ID */ switch(obj_type) { case H5I_FILE: - if((ret_value = H5I_register2(obj_type, obj, vol_plugin, app_ref)) < 0) + if((ret_value = H5VL_register_id(obj_type, obj, vol_plugin, app_ref)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") break; case H5I_ATTR: - if((ret_value = H5I_register2(obj_type, obj, vol_plugin, app_ref)) < 0) + if((ret_value = H5VL_register_id(obj_type, obj, vol_plugin, app_ref)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize attribute handle") break; case H5I_GROUP: - if((ret_value = H5I_register2(obj_type, obj, vol_plugin, app_ref)) < 0) + if((ret_value = H5VL_register_id(obj_type, obj, vol_plugin, app_ref)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize group handle") break; case H5I_DATASET: - if((ret_value = H5I_register2(obj_type, obj, vol_plugin, app_ref)) < 0) + if((ret_value = H5VL_register_id(obj_type, obj, vol_plugin, app_ref)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") break; @@ -417,7 +487,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, +H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -425,18 +495,14 @@ H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, co FUNC_ENTER_NOAPI(NULL) /* check if the corresponding VOL create callback exists */ - if(NULL == vol_plugin->cls->attr_cls.create) + if(NULL == vol_cls->attr_cls.create) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "vol plugin has no `attr create' method") /* call the corresponding VOL create callback */ - if(NULL == (ret_value = (vol_plugin->cls->attr_cls.create) + if(NULL == (ret_value = (vol_cls->attr_cls.create) (obj, loc_params, name, acpl_id, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") - vol_plugin->nrefs ++; - if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, NULL, "unable to increment ref count on VOL plugin") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_create() */ @@ -457,7 +523,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, +H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -465,17 +531,14 @@ H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, cons FUNC_ENTER_NOAPI(NULL) /* check if the type specific corresponding VOL open callback exists */ - if(NULL == vol_plugin->cls->attr_cls.open) + if(NULL == vol_cls->attr_cls.open) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "vol plugin has no `attr open' method") + /* call the corresponding VOL open callback */ - if(NULL == (ret_value = (vol_plugin->cls->attr_cls.open) + if(NULL == (ret_value = (vol_cls->attr_cls.open) (obj, loc_params, name, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed") - vol_plugin->nrefs ++; - if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, NULL, "unable to increment ref count on VOL plugin") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_open() */ @@ -495,16 +558,16 @@ done: * *------------------------------------------------------------------------- */ -herr_t H5VL_attr_read(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, void *buf, +herr_t H5VL_attr_read(void *attr, const H5VL_class_t *vol_cls, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->attr_cls.read) + if(NULL == vol_cls->attr_cls.read) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr read' method") - if((ret_value = (vol_plugin->cls->attr_cls.read)(attr, mem_type_id, buf, dxpl_id, req)) < 0) + if((ret_value = (vol_cls->attr_cls.read)(attr, mem_type_id, buf, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "read failed") done: @@ -526,16 +589,16 @@ done: * *------------------------------------------------------------------------- */ -herr_t H5VL_attr_write(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, const void *buf, +herr_t H5VL_attr_write(void *attr, const H5VL_class_t *vol_cls, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->attr_cls.write) + if(NULL == vol_cls->attr_cls.write) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr write' method") - if((ret_value = (vol_plugin->cls->attr_cls.write)(attr, mem_type_id, buf, dxpl_id, req)) < 0) + if((ret_value = (vol_cls->attr_cls.write)(attr, mem_type_id, buf, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "write failed") done: @@ -558,7 +621,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_get(void *obj, H5VL_t *vol_plugin, H5VL_attr_get_t get_type, +H5VL_attr_get(void *obj, const H5VL_class_t *vol_cls, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ @@ -566,11 +629,11 @@ H5VL_attr_get(void *obj, H5VL_t *vol_plugin, H5VL_attr_get_t get_type, FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->attr_cls.get) + if(NULL == vol_cls->attr_cls.get) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr get' method") va_start (arguments, req); - if((ret_value = (vol_plugin->cls->attr_cls.get) + if((ret_value = (vol_cls->attr_cls.get) (obj, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") va_end (arguments); @@ -595,7 +658,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, +H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ @@ -603,11 +666,11 @@ H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->attr_cls.specific) + if(NULL == vol_cls->attr_cls.specific) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr specific' method") va_start (arguments, req); - if((ret_value = (vol_plugin->cls->attr_cls.specific) + if((ret_value = (vol_cls->attr_cls.specific) (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") va_end (arguments); @@ -632,18 +695,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...) +H5VL_attr_optional(void *obj, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->attr_cls.optional) + if(NULL == vol_cls->attr_cls.optional) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr optional' method") va_start (arguments, req); - if((ret_value = (vol_plugin->cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") va_end (arguments); @@ -667,23 +730,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_close(void *attr, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) +H5VL_attr_close(void *attr, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->attr_cls.close) + if(NULL == vol_cls->attr_cls.close) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr close' method") - if((ret_value = (vol_plugin->cls->attr_cls.close)(attr, dxpl_id, req)) < 0) + if((ret_value = (vol_cls->attr_cls.close)(attr, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") - vol_plugin->nrefs --; - if(H5I_dec_ref(vol_plugin->id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin") - if (0 == vol_plugin->nrefs) - vol_plugin = (H5VL_t *)H5MM_xfree(vol_plugin); - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_close() */ @@ -704,7 +761,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, +H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req) { @@ -713,18 +770,14 @@ H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin FUNC_ENTER_NOAPI(NULL) /* check if the corresponding VOL commit callback exists */ - if(NULL == vol_plugin->cls->datatype_cls.commit) + if(NULL == vol_cls->datatype_cls.commit) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "vol plugin has no `datatype commit' method") /* call the corresponding VOL commit callback */ - if(NULL == (ret_value = (vol_plugin->cls->datatype_cls.commit) + if(NULL == (ret_value = (vol_cls->datatype_cls.commit) (obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "commit failed") - vol_plugin->nrefs ++; - if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, NULL, "unable to increment ref count on VOL plugin") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_commit() */ @@ -745,7 +798,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, +H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -753,18 +806,14 @@ H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, FUNC_ENTER_NOAPI(NULL) /* check if the type specific corresponding VOL open callback exists */ - if(NULL == vol_plugin->cls->datatype_cls.open) + if(NULL == vol_cls->datatype_cls.open) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "no datatype open callback"); /* call the corresponding VOL open callback */ - if(NULL == (ret_value = (vol_plugin->cls->datatype_cls.open) + if(NULL == (ret_value = (vol_cls->datatype_cls.open) (obj, loc_params, name, tapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") - vol_plugin->nrefs ++; - if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, NULL, "unable to increment ref count on VOL plugin") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_open() */ @@ -785,7 +834,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_datatype_get(void *obj, H5VL_t *vol_plugin, H5VL_datatype_get_t get_type, +H5VL_datatype_get(void *obj, const H5VL_class_t *vol_cls, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ @@ -793,10 +842,10 @@ H5VL_datatype_get(void *obj, H5VL_t *vol_plugin, H5VL_datatype_get_t get_type, FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->datatype_cls.get) + if(NULL == vol_cls->datatype_cls.get) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `datatype get' method") va_start (arguments, req); - if((ret_value = (vol_plugin->cls->datatype_cls.get)(obj, get_type, dxpl_id, + if((ret_value = (vol_cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") va_end (arguments); @@ -821,7 +870,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_datatype_specific(void *obj, H5VL_t *vol_plugin, H5VL_datatype_specific_t specific_type, +H5VL_datatype_specific(void *obj, const H5VL_class_t *vol_cls, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ @@ -829,11 +878,11 @@ H5VL_datatype_specific(void *obj, H5VL_t *vol_plugin, H5VL_datatype_specific_t s FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->datatype_cls.specific) + if(NULL == vol_cls->datatype_cls.specific) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `datatype specific' method") va_start (arguments, req); - if((ret_value = (vol_plugin->cls->datatype_cls.specific) + if((ret_value = (vol_cls->datatype_cls.specific) (obj, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback") va_end (arguments); @@ -858,18 +907,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_datatype_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...) +H5VL_datatype_optional(void *obj, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->datatype_cls.optional) + if(NULL == vol_cls->datatype_cls.optional) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `datatype optional' method") va_start (arguments, req); - if((ret_value = (vol_plugin->cls->datatype_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->datatype_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback") va_end (arguments); @@ -892,26 +941,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_datatype_close(void *dt, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) +H5VL_datatype_close(void *dt, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* check if the corresponding VOL close callback exists */ - if(NULL == vol_plugin->cls->datatype_cls.close) + if(NULL == vol_cls->datatype_cls.close) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `datatype close' method") /* call the corresponding VOL close callback */ - if((ret_value = (vol_plugin->cls->datatype_cls.close)(dt, dxpl_id, req)) < 0) + if((ret_value = (vol_cls->datatype_cls.close)(dt, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") - if(H5I_dec_ref(vol_plugin->id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin") - vol_plugin->nrefs --; - if (0 == vol_plugin->nrefs) - vol_plugin = (H5VL_t *)H5MM_xfree(vol_plugin); - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_close() */ @@ -932,7 +975,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, +H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -940,18 +983,14 @@ H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, FUNC_ENTER_NOAPI(NULL) /* check if the corresponding VOL create callback exists */ - if(NULL == vol_plugin->cls->dataset_cls.create) + if(NULL == vol_cls->dataset_cls.create) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "vol plugin has no `dataset create' method") /* call the corresponding VOL create callback */ - if(NULL == (ret_value = (vol_plugin->cls->dataset_cls.create) + if(NULL == (ret_value = (vol_cls->dataset_cls.create) (obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") - vol_plugin->nrefs ++; - if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, NULL, "unable to increment ref count on VOL plugin") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_create() */ @@ -972,7 +1011,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, +H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -980,18 +1019,14 @@ H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, c FUNC_ENTER_NOAPI(NULL) /* check if the type specific corresponding VOL open callback exists */ - if(NULL == vol_plugin->cls->dataset_cls.open) + if(NULL == vol_cls->dataset_cls.open) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "vol plugin has no 'dset open' method") /* call the corresponding VOL open callback */ - if(NULL == (ret_value = (vol_plugin->cls->dataset_cls.open) + if(NULL == (ret_value = (vol_cls->dataset_cls.open) (obj, loc_params, name, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") - vol_plugin->nrefs ++; - if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, NULL, "unable to increment ref count on VOL plugin") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_open() */ @@ -1012,16 +1047,16 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_read(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, +H5VL_dataset_read(void *dset, const H5VL_class_t *vol_cls, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req) { herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->dataset_cls.read) + if(NULL == vol_cls->dataset_cls.read) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dataset read' method") - if((ret_value = (vol_plugin->cls->dataset_cls.read) + if((ret_value = (vol_cls->dataset_cls.read) (dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "read failed") @@ -1045,16 +1080,16 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_write(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, +H5VL_dataset_write(void *dset, const H5VL_class_t *vol_cls, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req) { herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->dataset_cls.write) + if(NULL == vol_cls->dataset_cls.write) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dataset write' method") - if((ret_value = (vol_plugin->cls->dataset_cls.write) + if((ret_value = (vol_cls->dataset_cls.write) (dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed") @@ -1078,7 +1113,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_get(void *dset, H5VL_t *vol_plugin, H5VL_dataset_get_t get_type, +H5VL_dataset_get(void *dset, const H5VL_class_t *vol_cls, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ @@ -1086,11 +1121,11 @@ H5VL_dataset_get(void *dset, H5VL_t *vol_plugin, H5VL_dataset_get_t get_type, FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->dataset_cls.get) + if(NULL == vol_cls->dataset_cls.get) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dataset get' method") va_start (arguments, req); - if((ret_value = (vol_plugin->cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") va_end (arguments); @@ -1114,7 +1149,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_specific(void *obj, H5VL_t *vol_plugin, H5VL_dataset_specific_t specific_type, +H5VL_dataset_specific(void *obj, const H5VL_class_t *vol_cls, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ @@ -1122,11 +1157,11 @@ H5VL_dataset_specific(void *obj, H5VL_t *vol_plugin, H5VL_dataset_specific_t spe FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->dataset_cls.specific) + if(NULL == vol_cls->dataset_cls.specific) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dataset specific' method") va_start (arguments, req); - if((ret_value = (vol_plugin->cls->dataset_cls.specific) + if((ret_value = (vol_cls->dataset_cls.specific) (obj, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset specific callback") va_end (arguments); @@ -1151,18 +1186,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...) +H5VL_dataset_optional(void *obj, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->dataset_cls.optional) + if(NULL == vol_cls->dataset_cls.optional) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dataset optional' method") va_start (arguments, req); - if((ret_value = (vol_plugin->cls->dataset_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->dataset_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback") va_end (arguments); @@ -1186,26 +1221,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_close(void *dset, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) +H5VL_dataset_close(void *dset, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->dataset_cls.close) + if(NULL == vol_cls->dataset_cls.close) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dset close' method") - if((ret_value = (vol_plugin->cls->dataset_cls.close)(dset, dxpl_id, req)) < 0) + if((ret_value = (vol_cls->dataset_cls.close)(dset, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") done: - /* MSC - Weird thing for datasets and filters: - Always decrement the ref count on the vol for datasets, since - the ID is removed even if the close fails */ - vol_plugin->nrefs --; - if(H5I_dec_ref(vol_plugin->id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin") - if (0 == vol_plugin->nrefs) - vol_plugin = (H5VL_t *)H5MM_xfree(vol_plugin); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_close() */ @@ -1226,26 +1253,13 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_file_create(H5VL_t **plugin, const char *name, unsigned flags, hid_t fcpl_id, +H5VL_file_create(const H5VL_class_t *vol_cls, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req) { - H5P_genplist_t *plist; /* Property list pointer */ - hid_t vol_id; /* VOL plugin identigier attached to fapl_id */ - H5VL_class_t *vol_cls = NULL; /* VOL class of vol_id */ - H5VL_t *vol_plugin = NULL; /* the public VOL struct */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) - /* get the VOL info from the fapl */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(H5P_get(plist, H5F_ACS_VOL_ID_NAME, &vol_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol plugin ID") - - if(NULL == (vol_cls = (H5VL_class_t *)H5I_object(vol_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL ID") - /* check if the corresponding VOL create callback exists */ if(NULL == vol_cls->file_cls.create) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "vol plugin has no `file create' method") @@ -1253,17 +1267,6 @@ H5VL_file_create(H5VL_t **plugin, const char *name, unsigned flags, hid_t fcpl_i if(NULL == (ret_value = (vol_cls->file_cls.create)(name, flags, fcpl_id, fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") - /* Build the vol plugin struct */ - if(NULL == (*plugin = (H5VL_t *)H5MM_calloc(sizeof(H5VL_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - - vol_plugin = *plugin; - vol_plugin->cls = vol_cls; - vol_plugin->nrefs = 1; - vol_plugin->id = vol_id; - if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, NULL, "unable to increment ref count on VOL plugin") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_create() */ @@ -1284,26 +1287,13 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_file_open(H5VL_t **plugin, const char *name, unsigned flags, hid_t fapl_id, +H5VL_file_open(const H5VL_class_t *vol_cls, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req) { - H5P_genplist_t *plist; /* Property list pointer */ - hid_t vol_id; /* VOL plugin identigier attached to fapl_id */ - H5VL_class_t *vol_cls = NULL; /* VOL class of vol_id */ - H5VL_t *vol_plugin = NULL; /* the public VOL struct */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) - /* get the VOL info from the fapl */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(H5P_get(plist, H5F_ACS_VOL_ID_NAME, &vol_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol plugin ID") - - if(NULL == (vol_cls = (H5VL_class_t *)H5I_object(vol_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL ID") - /* check if the corresponding VOL create callback exists */ if(NULL == vol_cls->file_cls.open) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "vol plugin has no `file open' method") @@ -1311,17 +1301,6 @@ H5VL_file_open(H5VL_t **plugin, const char *name, unsigned flags, hid_t fapl_id, if(NULL == (ret_value = (vol_cls->file_cls.open)(name, flags, fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "open failed") - /* Build the vol plugin struct */ - if(NULL == (*plugin = (H5VL_t *)H5MM_calloc(sizeof(H5VL_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - - vol_plugin = *plugin; - vol_plugin->cls = vol_cls; - vol_plugin->nrefs = 1; - vol_plugin->id = vol_id; - if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, NULL, "unable to increment ref count on VOL plugin") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_open() */ @@ -1342,7 +1321,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_get(void *file, H5VL_t *vol_plugin, H5VL_file_get_t get_type, +H5VL_file_get(void *file, const H5VL_class_t *vol_cls, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ @@ -1350,11 +1329,11 @@ H5VL_file_get(void *file, H5VL_t *vol_plugin, H5VL_file_get_t get_type, FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->file_cls.get) + if(NULL == vol_cls->file_cls.get) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file get' method") va_start(arguments, req); - if((ret_value = (vol_plugin->cls->file_cls.get)(file, get_type, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->file_cls.get)(file, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") va_end(arguments); @@ -1377,7 +1356,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_specific(void *file, H5VL_t *vol_plugin, H5VL_file_specific_t specific_type, +H5VL_file_specific(void *file, const H5VL_class_t *vol_cls, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ @@ -1388,7 +1367,6 @@ H5VL_file_specific(void *file, H5VL_t *vol_plugin, H5VL_file_specific_t specific if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { H5P_genplist_t *plist; /* Property list pointer */ hid_t vol_id; /* VOL plugin identigier attached to fapl_id */ - H5VL_class_t *vol_cls; /* VOL class of vol_id */ va_list tmp_args; /* argument list passed from the API call */ hid_t fapl_id; @@ -1412,11 +1390,11 @@ H5VL_file_specific(void *file, H5VL_t *vol_plugin, H5VL_file_specific_t specific va_end (arguments); } else { - if(NULL == vol_plugin->cls->file_cls.specific) + if(NULL == vol_cls->file_cls.specific) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file specific' method") va_start (arguments, req); - if((ret_value = (vol_plugin->cls->file_cls.specific) + if((ret_value = (vol_cls->file_cls.specific) (file, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") va_end (arguments); @@ -1441,18 +1419,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_optional(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...) +H5VL_file_optional(void *file, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->file_cls.optional) + if(NULL == vol_cls->file_cls.optional) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file optional' method") va_start (arguments, req); - if((ret_value = (vol_plugin->cls->file_cls.optional)(file, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->file_cls.optional)(file, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "optional failed") va_end (arguments); @@ -1476,23 +1454,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_close(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) +H5VL_file_close(void *file, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->file_cls.close) + if(NULL == vol_cls->file_cls.close) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file close' method") - if((ret_value = (vol_plugin->cls->file_cls.close)(file, dxpl_id, req)) < 0) + if((ret_value = (vol_cls->file_cls.close)(file, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "close failed") - vol_plugin->nrefs --; - if(H5I_dec_ref(vol_plugin->id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin") - if (0 == vol_plugin->nrefs) - vol_plugin = (H5VL_t *)H5MM_xfree(vol_plugin); - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_close() */ @@ -1513,7 +1485,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, +H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -1521,18 +1493,14 @@ H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, c FUNC_ENTER_NOAPI(NULL) /* check if the corresponding VOL create callback exists */ - if(NULL == vol_plugin->cls->group_cls.create) + if(NULL == vol_cls->group_cls.create) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "vol plugin has no `group create' method") /* call the corresponding VOL create callback */ - if(NULL == (ret_value = (vol_plugin->cls->group_cls.create) + if(NULL == (ret_value = (vol_cls->group_cls.create) (obj, loc_params, name, gcpl_id, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") - vol_plugin->nrefs ++; - if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, NULL, "unable to increment ref count on VOL plugin") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_create() */ @@ -1553,24 +1521,20 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, +H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ FUNC_ENTER_NOAPI(NULL) - if(NULL == vol_plugin->cls->group_cls.open) + if(NULL == vol_cls->group_cls.open) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "vol plugin has no `group open' method") - if(NULL == (ret_value = (vol_plugin->cls->group_cls.open) + if(NULL == (ret_value = (vol_cls->group_cls.open) (obj, loc_params, name, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") - vol_plugin->nrefs ++; - if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, NULL, "unable to increment ref count on VOL plugin") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_open() */ @@ -1591,7 +1555,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_group_get(void *obj, H5VL_t *vol_plugin, H5VL_group_get_t get_type, +H5VL_group_get(void *obj, const H5VL_class_t *vol_cls, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ @@ -1599,11 +1563,11 @@ H5VL_group_get(void *obj, H5VL_t *vol_plugin, H5VL_group_get_t get_type, FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->group_cls.get) + if(NULL == vol_cls->group_cls.get) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `group get' method") va_start (arguments, req); - if((ret_value = (vol_plugin->cls->group_cls.get) + if((ret_value = (vol_cls->group_cls.get) (obj, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") va_end (arguments); @@ -1628,7 +1592,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_group_specific(void *obj, H5VL_t *vol_plugin, H5VL_group_specific_t specific_type, +H5VL_group_specific(void *obj, const H5VL_class_t *vol_cls, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ @@ -1636,11 +1600,11 @@ H5VL_group_specific(void *obj, H5VL_t *vol_plugin, H5VL_group_specific_t specifi FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->group_cls.specific) + if(NULL == vol_cls->group_cls.specific) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `group specific' method") va_start (arguments, req); - if((ret_value = (vol_plugin->cls->group_cls.specific) + if((ret_value = (vol_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") va_end (arguments); @@ -1665,18 +1629,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_group_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...) +H5VL_group_optional(void *obj, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->group_cls.optional) + if(NULL == vol_cls->group_cls.optional) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `group optional' method") va_start (arguments, req); - if((ret_value = (vol_plugin->cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") va_end (arguments); @@ -1700,23 +1664,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_group_close(void *grp, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) +H5VL_group_close(void *grp, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->group_cls.close) + if(NULL == vol_cls->group_cls.close) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `group close' method") - if((ret_value = (vol_plugin->cls->group_cls.close)(grp, dxpl_id, req)) < 0) + if((ret_value = (vol_cls->group_cls.close)(grp, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") - vol_plugin->nrefs --; - if(H5I_dec_ref(vol_plugin->id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin") - if (0 == vol_plugin->nrefs) - vol_plugin = (H5VL_t *)H5MM_xfree(vol_plugin); - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_close() */ @@ -1736,17 +1694,17 @@ done: */ herr_t H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, - H5VL_t *vol_plugin, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) + const H5VL_class_t *vol_cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* check if the corresponding VOL create callback exists */ - if(NULL == vol_plugin->cls->link_cls.create) + if(NULL == vol_cls->link_cls.create) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link create' method") /* call the corresponding VOL create callback */ - if((ret_value = (vol_plugin->cls->link_cls.create) + if((ret_value = (vol_cls->link_cls.create) (create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link create failed") @@ -1769,7 +1727,7 @@ done: */ herr_t H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin, + H5VL_loc_params_t loc_params2, const H5VL_class_t *vol_cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1777,11 +1735,11 @@ H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, FUNC_ENTER_NOAPI(FAIL) /* check if the corresponding VOL copy callback exists */ - if(NULL == vol_plugin->cls->link_cls.copy) + if(NULL == vol_cls->link_cls.copy) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link copy' method") /* call the corresponding VOL copy callback */ - if((ret_value = (vol_plugin->cls->link_cls.copy) + if((ret_value = (vol_cls->link_cls.copy) (src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, lapl_id, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link copy failed") @@ -1805,7 +1763,7 @@ done: */ herr_t H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin, + H5VL_loc_params_t loc_params2, const H5VL_class_t *vol_cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1813,11 +1771,11 @@ H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, FUNC_ENTER_NOAPI(FAIL) /* check if the corresponding VOL move callback exists */ - if(NULL == vol_plugin->cls->link_cls.move) + if(NULL == vol_cls->link_cls.move) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link move' method") /* call the corresponding VOL move callback */ - if((ret_value = (vol_plugin->cls->link_cls.move) + if((ret_value = (vol_cls->link_cls.move) (src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, lapl_id, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link move failed") @@ -1842,7 +1800,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_link_get_t get_type, +H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ @@ -1850,11 +1808,11 @@ H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_ FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->link_cls.get) + if(NULL == vol_cls->link_cls.get) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link get' method") va_start (arguments, req); - if((ret_value = (vol_plugin->cls->link_cls.get) + if((ret_value = (vol_cls->link_cls.get) (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") va_end (arguments); @@ -1879,7 +1837,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, +H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ @@ -1887,11 +1845,11 @@ H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->link_cls.specific) + if(NULL == vol_cls->link_cls.specific) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link specific' method") va_start (arguments, req); - if((ret_value = (vol_plugin->cls->link_cls.specific) + if((ret_value = (vol_cls->link_cls.specific) (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") va_end (arguments); @@ -1916,18 +1874,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_link_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...) +H5VL_link_optional(void *obj, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->link_cls.optional) + if(NULL == vol_cls->link_cls.optional) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link optional' method") va_start (arguments, req); - if((ret_value = (vol_plugin->cls->link_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->link_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") va_end (arguments); @@ -1951,7 +1909,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_object_open(void *obj, H5VL_loc_params_t params, H5VL_t *vol_plugin, H5I_type_t *opened_type, +H5VL_object_open(void *obj, H5VL_loc_params_t params, const H5VL_class_t *vol_cls, H5I_type_t *opened_type, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -1959,18 +1917,14 @@ H5VL_object_open(void *obj, H5VL_loc_params_t params, H5VL_t *vol_plugin, H5I_ty FUNC_ENTER_NOAPI(NULL) /* check if the corresponding VOL open callback exists */ - if(NULL == vol_plugin->cls->object_cls.open) + if(NULL == vol_cls->object_cls.open) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "vol plugin has no `object open' method") /* call the corresponding VOL open callback */ - if(NULL == (ret_value = (vol_plugin->cls->object_cls.open) + if(NULL == (ret_value = (vol_cls->object_cls.open) (obj, params, opened_type, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") - vol_plugin->nrefs++; - if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, NULL, "unable to increment ref count on VOL plugin") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_object_open() */ @@ -1990,8 +1944,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, H5VL_t *vol_plugin1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin2, const char *dst_name, +H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const H5VL_class_t *vol_cls1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *vol_cls2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -1999,13 +1953,13 @@ H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, H5VL_t *vol_plugi FUNC_ENTER_NOAPI(FAIL) /* check if both objects are associated with the same VOL plugin */ - if(vol_plugin1->cls->value != vol_plugin2->cls->value) + if(vol_cls1->value != vol_cls2->value) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be copied") - if(NULL == vol_plugin1->cls->object_cls.copy) + if(NULL == vol_cls1->object_cls.copy) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object copy' method") - if((ret_value = (vol_plugin1->cls->object_cls.copy) + if((ret_value = (vol_cls1->object_cls.copy) (src_obj, loc_params1, src_name, dst_obj, loc_params2, dst_name, ocpypl_id, lcpl_id, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "copy failed") @@ -2030,7 +1984,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_get_t get_type, +H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ @@ -2038,11 +1992,11 @@ H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5V FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->object_cls.get) + if(NULL == vol_cls->object_cls.get) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object get' method") va_start (arguments, req); - if((ret_value = (vol_plugin->cls->object_cls.get) + if((ret_value = (vol_cls->object_cls.get) (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") va_end (arguments); @@ -2066,7 +2020,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, +H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ @@ -2074,11 +2028,11 @@ H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->object_cls.specific) + if(NULL == vol_cls->object_cls.specific) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object specific' method") va_start (arguments, req); - if((ret_value = (vol_plugin->cls->object_cls.specific) + if((ret_value = (vol_cls->object_cls.specific) (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") va_end (arguments); @@ -2103,18 +2057,18 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_object_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...) +H5VL_object_optional(void *obj, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->object_cls.optional) + if(NULL == vol_cls->object_cls.optional) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object optional' method") va_start (arguments, req); - if((ret_value = (vol_plugin->cls->object_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + if((ret_value = (vol_cls->object_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback") va_end (arguments); @@ -2137,15 +2091,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_request_cancel(void **req, H5VL_t *vol_plugin, H5ES_status_t *status) +H5VL_request_cancel(void **req, const H5VL_class_t *vol_cls, H5ES_status_t *status) { herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->async_cls.cancel) + if(NULL == vol_cls->async_cls.cancel) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `async cancel' method"); - if((ret_value = (vol_plugin->cls->async_cls.cancel)(req, status)) < 0) + if((ret_value = (vol_cls->async_cls.cancel)(req, status)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed") done: @@ -2167,15 +2121,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_request_test(void **req, H5VL_t *vol_plugin, H5ES_status_t *status) +H5VL_request_test(void **req, const H5VL_class_t *vol_cls, H5ES_status_t *status) { herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->async_cls.test) + if(NULL == vol_cls->async_cls.test) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `async test' method"); - if((ret_value = (vol_plugin->cls->async_cls.test)(req, status)) < 0) + if((ret_value = (vol_cls->async_cls.test)(req, status)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request test failed") done: @@ -2197,15 +2151,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_request_wait(void **req, H5VL_t *vol_plugin, H5ES_status_t *status) +H5VL_request_wait(void **req, const H5VL_class_t *vol_cls, H5ES_status_t *status) { herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->async_cls.wait) + if(NULL == vol_cls->async_cls.wait) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `async wait' method"); - if((ret_value = (vol_plugin->cls->async_cls.wait)(req, status)) < 0) + if((ret_value = (vol_cls->async_cls.wait)(req, status)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed") done: diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 295f146..7277a92 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -244,7 +244,7 @@ H5VL_native_init(void) /* Register the Native VOL, if it isn't already */ if(NULL == H5I_object_verify(H5VL_NATIVE_g, H5I_VOL)) { if((H5VL_NATIVE_g = H5VL_register((const H5VL_class_t *)&H5VL_native_g, - sizeof(H5VL_class_t), FALSE)) < 0) + sizeof(H5VL_class_t), TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, FAIL, "can't create ID for native plugin") } @@ -255,29 +255,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_native_init() */ -#if 0 - -/*--------------------------------------------------------------------------- - * Function: H5VL_native_term - * - * Purpose: Shut down the VOL plugin - * - * Returns: SUCCEED (Can't fail) - * - *--------------------------------------------------------------------------- - */ -static herr_t -H5VL_native_term(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* Reset VFL ID */ - H5VL_NATIVE_g = 0; - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5VL_native_term() */ -#endif - /*--------------------------------------------------------------------------- * Function: H5VL_native_get_file @@ -388,10 +365,7 @@ H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref) if(NULL == (vol_plugin = (H5VL_t *)H5MM_calloc(sizeof(H5VL_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") vol_plugin->cls = &H5VL_native_g; - vol_plugin->nrefs = 1; vol_plugin->id = H5VL_NATIVE_g; - if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin") /* Get an atom for the object */ if(type == H5I_DATATYPE && ((H5T_t *)obj)->vol_obj == NULL) { @@ -399,7 +373,7 @@ H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize object handle") } else { - if((ret_value = H5I_register2(type, obj, vol_plugin, app_ref)) < 0) + if((ret_value = H5VL_register_id(type, obj, vol_plugin, app_ref)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register object") } @@ -439,11 +413,9 @@ H5VL_native_unregister(hid_t obj_id) if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - vol_plugin->nrefs--; - if(H5I_dec_ref(vol_plugin->id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin") - if(0 == vol_plugin->nrefs) - H5MM_free(vol_plugin); + /* decrement ref count on VOL ID */ + if(H5VL_free_id(vol_plugin) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 0509a47..1234eb9 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -29,9 +29,20 @@ /****************************/ /* Library Private Typedefs */ /****************************/ + #define H5_REQUEST_NULL NULL #define H5_EVENT_STACK_NULL ((hid_t)-1) +/* + * The main datatype for each plugin. + */ +typedef struct H5VL_t { + const H5VL_class_t *cls; /* constant class info */ + unsigned long feature_flags; /* VOL Driver feature Flags */ + int nrefs; /* number of references by objects using this struct */ + hid_t id; /* identifier for the VOL class */ +} H5VL_t; + /*****************************/ /* Library Private Variables */ /*****************************/ @@ -48,70 +59,73 @@ H5_DLL herr_t H5VL_init(void); H5_DLL int H5VL_term_interface(void); H5_DLL hid_t H5VL_register(const void *cls, size_t size, hbool_t app_ref); H5_DLL hid_t H5VL_object_register(void *obj, H5I_type_t obj_type, H5VL_t *vol_plugin, hbool_t app_ref); +H5_DLL hid_t H5VL_create_datatype(void *dt_obj, H5VL_t *vol_plugin, hbool_t app_ref); +H5_DLL hid_t H5VL_register_id(H5I_type_t type, const void *object, H5VL_t *vol_plugin, hbool_t app_ref); +H5_DLL hid_t H5VL_free_id(H5VL_t *vol_plugin); H5_DLL ssize_t H5VL_get_plugin_name(hid_t id, char *name/*out*/, size_t size); H5_DLL void *H5VL_get_object(hid_t id); -H5_DLL void *H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_attr_read(void *attr, H5VL_t *vol_plugin, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_attr_write(void *attr, H5VL_t *vol_plugin, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_attr_get(void *obj, H5VL_t *vol_plugin, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_attr_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_attr_close(void *attr, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); - -H5_DLL void *H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_dataset_read(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); -H5_DLL herr_t H5VL_dataset_write(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); -H5_DLL herr_t H5VL_dataset_get(void *dset, H5VL_t *vol_plugin, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_dataset_specific(void *obj, H5VL_t *vol_plugin, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_dataset_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_dataset_close(void *dset, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); - -H5_DLL void *H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_datatype_get(void *dt, H5VL_t *vol_plugin, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_datatype_specific(void *obj, H5VL_t *vol_plugin, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_datatype_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_datatype_close(void *dt, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); - -H5_DLL void *H5VL_file_create(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VL_file_open(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_file_get(void *file, H5VL_t *vol_plugin, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_file_specific(void *obj, H5VL_t *vol_plugin, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_file_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_file_close(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); - -H5_DLL void *H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, 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, H5VL_t *vol_plugin, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_group_get(void *obj, H5VL_t *vol_plugin, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_group_specific(void *obj, H5VL_t *vol_plugin, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_group_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_group_close(void *grp, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); - -H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_attr_read(void *attr, const H5VL_class_t *vol_cls, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_attr_write(void *attr, const H5VL_class_t *vol_cls, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_attr_get(void *obj, const H5VL_class_t *vol_cls, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_attr_optional(void *obj, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_attr_close(void *attr, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req); + +H5_DLL void *H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_dataset_read(void *dset, const H5VL_class_t *vol_cls, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); +H5_DLL herr_t H5VL_dataset_write(void *dset, const H5VL_class_t *vol_cls, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); +H5_DLL herr_t H5VL_dataset_get(void *dset, const H5VL_class_t *vol_cls, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_dataset_specific(void *obj, const H5VL_class_t *vol_cls, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_dataset_optional(void *obj, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_dataset_close(void *dset, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req); + +H5_DLL void *H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_datatype_get(void *dt, const H5VL_class_t *vol_cls, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_datatype_specific(void *obj, const H5VL_class_t *vol_cls, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_datatype_optional(void *obj, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_datatype_close(void *dt, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req); + +H5_DLL void *H5VL_file_create(const H5VL_class_t *vol_cls, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_file_open(const H5VL_class_t *vol_cls, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_file_get(void *file, const H5VL_class_t *vol_cls, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_file_specific(void *obj, const H5VL_class_t *vol_cls, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_file_optional(void *obj, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_file_close(void *file, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req); + +H5_DLL void *H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_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 *vol_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 *vol_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 *vol_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 *vol_cls, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_group_close(void *grp, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req); + +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 *vol_cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin, + void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *vol_cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin, + void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *vol_cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_link_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_link_optional(void *obj, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req, ...); -H5_DLL void *H5VL_object_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5I_type_t *opened_type, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, H5VL_t *vol_plugin1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin2, const char *dst_name, +H5_DLL void *H5VL_object_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const H5VL_class_t *vol_cls1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *vol_cls2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_object_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *vol_cls, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_object_optional(void *obj, const H5VL_class_t *vol_cls, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_request_cancel(void **req, H5VL_t *vol_plugin, H5ES_status_t *status); -H5_DLL herr_t H5VL_request_test(void **req, H5VL_t *vol_plugin, H5ES_status_t *status); -H5_DLL herr_t H5VL_request_wait(void **req, H5VL_t *vol_plugin, H5ES_status_t *status); +H5_DLL herr_t H5VL_request_cancel(void **req, const H5VL_class_t *vol_cls, H5ES_status_t *status); +H5_DLL herr_t H5VL_request_test(void **req, const H5VL_class_t *vol_cls, H5ES_status_t *status); +H5_DLL herr_t H5VL_request_wait(void **req, const H5VL_class_t *vol_cls, H5ES_status_t *status); H5_DLL herr_t H5VL_fapl_open(struct H5P_genplist_t *plist, hid_t vol_id, const void *vol_info); H5_DLL herr_t H5VL_fapl_copy(hid_t vol_id, const void *vol_info, void **copied_info); diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index f81ca1d..c3face6 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -347,95 +347,83 @@ typedef struct H5VL_class_t { herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); } H5VL_class_t; -/* - * The main datatype for each plugin. Public fields common to all - * plugins are declared here and the plugin appends private fields in - * memory. - */ -typedef struct H5VL_t { - const H5VL_class_t *cls; /* constant class info */ - unsigned long feature_flags; /* VOL Driver feature Flags */ - int nrefs; /* number of references by objects using this struct */ - hid_t id; /* identifier for the VOL class */ -} H5VL_t; - #ifdef __cplusplus extern "C" { #endif -H5_DLL void *H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLattr_read(void *attr, H5VL_t *vol_plugin, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLattr_write(void *attr, H5VL_t *vol_plugin, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLattr_get(void *obj, H5VL_t *vol_plugin, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLattr_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLattr_close(void *attr, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); - -H5_DLL void *H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLdataset_read(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); -H5_DLL herr_t H5VLdataset_write(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); -H5_DLL herr_t H5VLdataset_get(void *dset, H5VL_t *vol_plugin, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdataset_specific(void *obj, H5VL_t *vol_plugin, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdataset_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdataset_close(void *dset, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); - -H5_DLL void *H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLdatatype_get(void *dt, H5VL_t *vol_plugin, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdatatype_specific(void *obj, H5VL_t *vol_plugin, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdatatype_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdatatype_close(void *dt, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); - -H5_DLL void *H5VLfile_create(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLfile_open(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLfile_get(void *file, H5VL_t *vol_plugin, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLfile_specific(void *obj, H5VL_t *vol_plugin, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLfile_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLfile_close(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); - -H5_DLL void *H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLgroup_get(void *obj, H5VL_t *vol_plugin, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLgroup_specific(void *obj, H5VL_t *vol_plugin, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLgroup_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLgroup_close(void *grp, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); - -H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_read(void *attr, hid_t plugin_id, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_write(void *attr, hid_t plugin_id, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_get(void *obj, hid_t plugin_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_close(void *attr, hid_t plugin_id, hid_t dxpl_id, void **req); + +H5_DLL void *H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLdataset_read(void *dset, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); +H5_DLL herr_t H5VLdataset_write(void *dset, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); +H5_DLL herr_t H5VLdataset_get(void *dset, hid_t plugin_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_specific(void *obj, hid_t plugin_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_close(void *dset, hid_t plugin_id, hid_t dxpl_id, void **req); + +H5_DLL void *H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t plugin_id, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_specific(void *obj, hid_t plugin_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t plugin_id, hid_t dxpl_id, void **req); + +H5_DLL void *H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLfile_get(void *file, hid_t plugin_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_specific(void *obj, hid_t plugin_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_close(void *file, hid_t plugin_id, hid_t dxpl_id, void **req); + +H5_DLL void *H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLgroup_get(void *obj, hid_t plugin_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_specific(void *obj, hid_t plugin_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_close(void *grp, hid_t plugin_id, hid_t dxpl_id, void **req); + +H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t plugin_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t plugin_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLlink_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLlink_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL void *H5VLobject_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5I_type_t *opened_type, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, H5VL_t *vol_plugin1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin2, const char *dst_name, +H5_DLL void *H5VLobject_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, hid_t plugin_id1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t plugin_id2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLobject_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLobject_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLrequest_cancel(void **req, H5VL_t *vol_plugin, H5ES_status_t *status); -H5_DLL herr_t H5VLrequest_test(void **req, H5VL_t *vol_plugin, H5ES_status_t *status); -H5_DLL herr_t H5VLrequest_wait(void **req, H5VL_t *vol_plugin, H5ES_status_t *status); +H5_DLL herr_t H5VLrequest_cancel(void **req, hid_t plugin_id, H5ES_status_t *status); +H5_DLL herr_t H5VLrequest_test(void **req, hid_t plugin_id, H5ES_status_t *status); +H5_DLL herr_t H5VLrequest_wait(void **req, hid_t plugin_id, H5ES_status_t *status); /* Function prototypes */ H5_DLL herr_t H5VLinitialize(hid_t plugin_id, hid_t vipl_id); H5_DLL herr_t H5VLterminate(hid_t plugin_id, hid_t vtpl_id); -H5_DLL hid_t H5VLget_plugin_id(const H5VL_class_t *cls); +H5_DLL hid_t H5VLget_plugin_id(const char *name); H5_DLL herr_t H5VLclose(hid_t plugin_id); H5_DLL hid_t H5VLregister(const H5VL_class_t *cls); H5_DLL herr_t H5VLunregister(hid_t plugin_id); -H5_DLL htri_t H5VLis_registered(const H5VL_class_t *cls); +H5_DLL htri_t H5VLis_registered(const char *name); H5_DLL ssize_t H5VLget_plugin_name(hid_t id, char *name/*out*/, size_t size); -H5_DLL hid_t H5VLobject_register(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls); -H5_DLL herr_t H5VLget_object(hid_t obj_id, void **obj, H5VL_t **vol_plugin); +H5_DLL hid_t H5VLobject_register(void *obj, H5I_type_t obj_type, hid_t plugin_id); +H5_DLL herr_t H5VLget_object(hid_t obj_id, void **obj); #if 0 H5_DLL hid_t H5VLregister_by_name(const char *plugin_name); H5_DLL herr_t H5VLioctl(hid_t loc_id or vol_id, , ...); diff --git a/tools/misc/repart_test.c b/tools/misc/repart_test.c index e6da779..e718ee1 100644 --- a/tools/misc/repart_test.c +++ b/tools/misc/repart_test.c @@ -87,6 +87,7 @@ test_family_h5repart_opens(void) error: H5E_BEGIN_TRY { H5Fclose(file); + H5Pclose(fapl); } H5E_END_TRY; return -1; } -- cgit v0.12