diff options
111 files changed, 9719 insertions, 6567 deletions
@@ -886,6 +886,7 @@ ./src/H5TS.c ./src/H5TSprivate.h ./src/H5VL.c +./src/H5VLcallback.c ./src/H5VLint.c ./src/H5VLmodule.h ./src/H5VLnative.c @@ -68,6 +68,7 @@ $Source = ""; "unsigned" => "Iu", "unsigned int" => "Iu", "uint32_t" => "Iu", + "uint64_t" => "UL", "H5I_type_t" => "It", "H5G_link_t" => "Ll", #Same as H5L_type_t now "H5L_type_t" => "Ll", @@ -111,6 +112,7 @@ $Source = ""; "H5VL_link_specific_t" => "Vm", "H5VL_object_get_t" => "Vn", "H5VL_object_specific_t" => "Vo", + "H5VL_request_specific_t" => "Vr", "void" => "x", "FILE" => "x", "H5A_operator_t" => "x", @@ -315,7 +317,7 @@ sub rewrite_func ($$$$$) { # Ignored due to NO TRACE comment. } elsif ($body =~ s/((\n[ \t]*)H5TRACE\d+\s*\(.*?\);)\n/"$2$trace"/es) { # Replaced an H5TRACE macro. - } elsif ($body=~s/((\n[ \t]*)FUNC_ENTER\w*\s*(\(.*?\))?;??)\n/"$1$2$trace"/es) { + } elsif ($body=~s/((\n[ \t]*)FUNC_ENTER\w*[ \t]*(\(.*?\))?;??)\n/"$1$2$trace"/es) { # Added an H5TRACE macro after a FUNC_ENTER macro. } else { errmesg $file, $name, "unable to insert tracing information"; diff --git a/examples/h5_extlink.c b/examples/h5_extlink.c index 1a07656..229e465 100644 --- a/examples/h5_extlink.c +++ b/examples/h5_extlink.c @@ -208,7 +208,7 @@ static void extlink_prefix_example(void) * that a path was supplied in the udata. */ static hid_t UD_soft_traverse(const char *link_name, hid_t cur_group, - const void *udata, size_t udata_size, hid_t lapl_id); + const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id); static void soft_link_example(void) { @@ -277,7 +277,7 @@ static void soft_link_example(void) */ static hid_t UD_soft_traverse(const char *link_name, hid_t cur_group, - const void *udata, size_t udata_size, hid_t lapl_id) + const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id) { const char *target = (const char *) udata; hid_t ret_value; diff --git a/examples/h5_vol_external_log_native.c b/examples/h5_vol_external_log_native.c index 616214d..0d48b73 100644 --- a/examples/h5_vol_external_log_native.c +++ b/examples/h5_vol_external_log_native.c @@ -7,7 +7,7 @@ #define LOG 502 static herr_t H5VL_log_init(hid_t vipl_id); -static herr_t H5VL_log_term(hid_t vtpl_id); +static herr_t H5VL_log_term(void); /* Datatype callbacks */ static void *H5VL_log_datatype_commit(void *obj, H5VL_loc_params_t loc_params, 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); @@ -40,17 +40,23 @@ 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_driver_id = -1; +hid_t native_connector_id = -1; static const H5VL_class_t H5VL_log_g = { - 0, - LOG, - "log", /* name */ + 0, /* VOL class struct version */ + LOG, /* ID of connector */ + "log", /* Name of connector */ + 0, /* capability flags */ H5VL_log_init, /* initialize */ H5VL_log_term, /* terminate */ - sizeof(hid_t), - NULL, - NULL, + sizeof(hid_t), /* info size */ + NULL, /* info copy */ + NULL, /* info compare */ + NULL, /* info free */ + NULL, /* get_object */ + NULL, /* get_wrap_ctx */ + NULL, /* free_wrap_ctx */ + NULL, /* wrap_object */ { /* attribute_cls */ NULL, /* H5VL_log_attr_create, */ /* create */ NULL, /* H5VL_log_attr_open, */ /* open */ @@ -110,10 +116,12 @@ static const H5VL_class_t H5VL_log_g = { H5VL_log_object_specific, /* specific */ NULL /* H5VL_log_object_optional, */ /* optional */ }, - { - NULL, - NULL, - NULL + { /* request_cls */ + NULL, /* wait */ + NULL, /* cancel */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* free */ }, NULL }; @@ -129,8 +137,8 @@ visit_cb(hid_t oid, const char *name, const H5O_info_t *oinfo, void *udata) char n[25]; if(H5Iget_type(oid) == H5I_GROUP) { - len = H5VLget_driver_name(oid, n, 50); - printf ("Visiting GROUP VOL name = %s %lu\n", n, (unsigned long)len); + len = H5VLget_connector_name(oid, n, 50); + printf("Visiting GROUP VOL name = %s %zd\n", n, len); } if(H5Iget_type(oid) == H5I_DATASET) printf("visiting dataset\n"); @@ -144,12 +152,12 @@ int main(int argc, char **argv) { const char file_name[]="large_dataset.h5"; - const char group_name[]="/Group"; - const char dataset_name[]="Data"; - char fullpath[500]; - hid_t file_id; - hid_t group_id; - hid_t dataspaceId; + const char group_name[]="/Group"; + const char dataset_name[]="Data"; + char fullpath[500]; + hid_t file_id; + hid_t group_id; + hid_t dataspaceId; hid_t datasetId; hid_t acc_tpl; hid_t under_fapl; @@ -167,44 +175,43 @@ main(int argc, char **argv) under_fapl = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_native(under_fapl); - assert(H5VLis_driver_registered("native") == 1); + assert(H5VLis_connector_registered("native") == 1); - vol_id = H5VLregister_driver(&H5VL_log_g); + vol_id = H5VLregister_connector(&H5VL_log_g, H5P_DEFAULT); assert(vol_id > 0); - assert(H5VLis_driver_registered("log") == 1); + assert(H5VLis_connector_registered("log") == 1); - vol_id2 = H5VLget_driver_id("log"); - H5VLinitialize(vol_id2, H5P_DEFAULT); + vol_id2 = H5VLget_connector_id("log"); H5VLclose(vol_id2); - native_driver_id = H5VLget_driver_id("native"); - assert(native_driver_id > 0); + native_connector_id = H5VLget_connector_id("native"); + assert(native_connector_id > 0); acc_tpl = H5Pcreate (H5P_FILE_ACCESS); H5Pset_vol(acc_tpl, vol_id, &under_fapl); file_id = H5Fcreate(file_name, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl); - len = H5VLget_driver_name(file_id, name, 25); - printf("FILE VOL name = %s %lu\n", name, (unsigned long)len); + len = H5VLget_connector_name(file_id, name, 25); + printf("FILE VOL name = %s %zd\n", name, len); group_id = H5Gcreate2(file_id, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - len = H5VLget_driver_name(group_id, name, 50); - printf("GROUP VOL name = %s %lu\n", name, (unsigned long)len); + len = H5VLget_connector_name(group_id, name, 50); + printf("GROUP VOL name = %s %zd\n", name, len); int_id = H5Tcopy(H5T_NATIVE_INT); H5Tcommit2(file_id, "int", int_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - len = H5VLget_driver_name(int_id, name, 50); - printf("DT COMMIT name = %s %lu\n", name, (unsigned long)len); + len = H5VLget_connector_name(int_id, name, 50); + printf("DT COMMIT name = %s %zd\n", name, len); H5Tclose(int_id); int_id = H5Topen2(file_id, "int", H5P_DEFAULT); - len = H5VLget_driver_name(int_id, name, 50); - printf("DT OPEN name = %s %lu\n", name, (unsigned long)len); + len = H5VLget_connector_name(int_id, name, 50); + printf("DT OPEN name = %s %zd\n", name, len); H5Tclose(int_id); int_id = H5Oopen(file_id,"int",H5P_DEFAULT); - len = H5VLget_driver_name(int_id, name, 50); - printf("DT OPEN name = %s %lu\n", name, (unsigned long)len); + len = H5VLget_connector_name(int_id, name, 50); + printf("DT OOPEN name = %s %zd\n", name, len); len = H5Fget_name(file_id, name, 50); printf("name = %lu %s\n", (unsigned long)len, name); @@ -221,8 +228,8 @@ main(int argc, char **argv) datasetId = H5Dcreate2(file_id,fullpath,H5T_NATIVE_INT,dataspaceId,H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT); H5Sclose(dataspaceId); - len = H5VLget_driver_name(datasetId, name, 50); - printf ("DSET name = %s %lu\n", name, (unsigned long)len); + len = H5VLget_connector_name(datasetId, name, 50); + printf("DSET name = %s %zd\n", name, len); H5Dwrite(datasetId, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); H5Dclose(datasetId); @@ -237,10 +244,9 @@ main(int argc, char **argv) H5Pclose(acc_tpl); H5Pclose(under_fapl); - H5VLclose(native_driver_id); - H5VLterminate(vol_id, H5P_DEFAULT); - H5VLunregister_driver(vol_id); - assert(H5VLis_driver_registered("log") == 0); + H5VLclose(native_connector_id); + H5VLunregister_connector(vol_id); + assert(H5VLis_connector_registered("log") == 0); return EXIT_SUCCESS; } @@ -253,7 +259,7 @@ H5VL_log_init(hid_t vipl_id) } static herr_t -H5VL_log_term(hid_t vtpl_id) +H5VL_log_term(void) { printf("------- LOG TERM\n"); return 1; @@ -262,12 +268,12 @@ H5VL_log_term(hid_t vtpl_id) static void * H5VL_log_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req) { - hid_t under_fapl; + hid_t under_fapl = -1; H5VL_log_t *file; file = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - under_fapl = *((hid_t *)H5Pget_vol_info(fapl_id)); + H5Pget_vol_info(fapl_id, &under_fapl); file->under_object = H5VLfile_create(name, flags, fcpl_id, under_fapl, dxpl_id, req); printf("------- LOG H5Fcreate\n"); @@ -277,12 +283,12 @@ H5VL_log_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl static void * H5VL_log_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req) { - hid_t under_fapl; + hid_t under_fapl = -1; H5VL_log_t *file; file = (H5VL_log_t *)calloc(1, sizeof(H5VL_log_t)); - under_fapl = *((hid_t *)H5Pget_vol_info(fapl_id)); + H5Pget_vol_info(fapl_id, &under_fapl); file->under_object = H5VLfile_open(name, flags, under_fapl, dxpl_id, req); printf("------- LOG H5Fopen\n"); @@ -294,7 +300,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, native_driver_id, get_type, dxpl_id, req, arguments); + H5VLfile_get(f->under_object, native_connector_id, get_type, dxpl_id, req, arguments); printf("------- LOG H5Fget %d\n", get_type); return 1; @@ -305,7 +311,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, native_driver_id, dxpl_id, req); + H5VLfile_close(f->under_object, native_connector_id, dxpl_id, req); free(f); printf("------- LOG H5Fclose\n"); @@ -321,7 +327,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, native_driver_id, name, gcpl_id, gapl_id, dxpl_id, req); + group->under_object = H5VLgroup_create(o->under_object, loc_params, native_connector_id, name, gcpl_id, gapl_id, dxpl_id, req); printf("------- LOG H5Gcreate\n"); return (void *)group; @@ -332,7 +338,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, native_driver_id, dxpl_id, req); + H5VLgroup_close(g->under_object, native_connector_id, dxpl_id, req); free(g); printf("------- LOG H5Gclose\n"); @@ -348,7 +354,7 @@ 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, native_driver_id, name, + dt->under_object = H5VLdatatype_commit(o->under_object, loc_params, native_connector_id, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req); printf("------- LOG H5Tcommit\n"); @@ -363,7 +369,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, native_driver_id, name, tapl_id, dxpl_id, req); + dt->under_object = H5VLdatatype_open(o->under_object, loc_params, native_connector_id, name, tapl_id, dxpl_id, req); printf("------- LOG H5Topen\n"); return (void *)dt; @@ -375,7 +381,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, native_driver_id, get_type, dxpl_id, req, arguments); + ret_value = H5VLdatatype_get(o->under_object, native_connector_id, get_type, dxpl_id, req, arguments); printf("------- LOG datatype get\n"); return ret_value; @@ -388,7 +394,7 @@ H5VL_log_datatype_close(void *dt, hid_t dxpl_id, void **req) assert(type->under_object); - H5VLdatatype_close(type->under_object, native_driver_id, dxpl_id, req); + H5VLdatatype_close(type->under_object, native_connector_id, dxpl_id, req); free(type); printf("------- LOG H5Tclose\n"); @@ -403,7 +409,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, native_driver_id, opened_type, dxpl_id, req); + new_obj->under_object = H5VLobject_open(o->under_object, loc_params, native_connector_id, opened_type, dxpl_id, req); printf("------- LOG H5Oopen\n"); return (void *)new_obj; @@ -415,7 +421,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, native_driver_id, specific_type, dxpl_id, req, arguments); + H5VLobject_specific(o->under_object, loc_params, native_connector_id, specific_type, dxpl_id, req, arguments); printf("------- LOG Object specific\n"); return 1; @@ -429,7 +435,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, native_driver_id, name, dcpl_id, dapl_id, dxpl_id, req); + dset->under_object = H5VLdataset_create(o->under_object, loc_params, native_connector_id, name, dcpl_id, dapl_id, dxpl_id, req); printf("------- LOG H5Dcreate\n"); return (void *)dset; @@ -443,7 +449,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, native_driver_id, name, dapl_id, dxpl_id, req); + dset->under_object = H5VLdataset_open(o->under_object, loc_params, native_connector_id, name, dapl_id, dxpl_id, req); printf("------- LOG H5Dopen\n"); return (void *)dset; @@ -455,7 +461,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, native_driver_id, mem_type_id, mem_space_id, file_space_id, + H5VLdataset_read(d->under_object, native_connector_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); printf("------- LOG H5Dread\n"); @@ -468,7 +474,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, native_driver_id, mem_type_id, mem_space_id, file_space_id, + H5VLdataset_write(d->under_object, native_connector_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); printf("------- LOG H5Dwrite\n"); @@ -480,7 +486,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, native_driver_id, dxpl_id, req); + H5VLdataset_close(d->under_object, native_connector_id, dxpl_id, req); free(d); printf("------- LOG H5Dclose\n"); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 31a38be..341fa7a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -625,6 +625,7 @@ IDE_GENERATED_PROPERTIES ("H5UC" "${H5UC_HDRS}" "${H5UC_SOURCES}" ) set (H5VL_SOURCES ${HDF5_SRC_DIR}/H5VL.c + ${HDF5_SRC_DIR}/H5VLcallback.c ${HDF5_SRC_DIR}/H5VLint.c ${HDF5_SRC_DIR}/H5VLnative.c ) @@ -296,18 +296,17 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, loc_params.obj_type = H5I_get_type(loc_id); /* Create the attribute */ - if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->driver->cls, attr_name, - acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_create(vol_obj, loc_params, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") /* Register the new attribute and get an ID for it */ - if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -349,7 +348,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id) { - void *attr = NULL; /* attr token from VOL plugin */ + void *attr = NULL; /* attr token from VOL connector */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5P_genplist_t *plist; /* Property list pointer */ H5VL_loc_params_t loc_params; @@ -402,18 +401,17 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the attribute */ - if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->driver->cls, attr_name, - acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_create(vol_obj, loc_params, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") /* Register the new attribute and get an ID for it */ - if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close (attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -442,7 +440,7 @@ done: hid_t H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) { - void *attr = NULL; /* attr token from VOL driver */ + void *attr = NULL; /* attr token from VOL connector */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; @@ -471,18 +469,17 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls, - attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_open(vol_obj, loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", attr_name) /* Register the attribute and get an ID for it */ - if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -514,7 +511,7 @@ hid_t H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t aapl_id, hid_t lapl_id) { - void *attr = NULL; /* attr token from VOL driver */ + void *attr = NULL; /* attr token from VOL connector */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; @@ -554,18 +551,17 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls, - attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_open(vol_obj, loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "can't open attribute") /* Register the attribute and get an ID for it */ - if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close (attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -646,18 +642,17 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls, - NULL, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_open(vol_obj, loc_params, NULL, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ - if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -702,8 +697,7 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") /* Write the attribute data */ - if((ret_value = H5VL_attr_write(vol_obj->data, vol_obj->driver->cls, - dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if((ret_value = H5VL_attr_write(vol_obj, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") done: @@ -745,8 +739,7 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL") /* Read the attribute data */ - if((ret_value = H5VL_attr_read(vol_obj->data, vol_obj->driver->cls, - dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if((ret_value = H5VL_attr_read(vol_obj, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") done: @@ -784,8 +777,7 @@ H5Aget_space(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") /* Get the dataspace */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_SPACE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace of attribute") done: @@ -812,7 +804,7 @@ done: hid_t H5Aget_type(hid_t attr_id) { - H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */ + H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -823,8 +815,7 @@ H5Aget_type(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") /* Get the datatype */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_TYPE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype of attribute") done: @@ -867,8 +858,7 @@ H5Aget_create_plist(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") /* Get the acpl */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_ACPL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_ACPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get creation property list for attribute") done: @@ -918,9 +908,7 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf) loc_params.obj_type = H5I_get_type(attr_id); /* Get the attribute name */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_NAME, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - loc_params, buf_size, buf, &ret_value) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, buf_size, buf, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute name") done: @@ -985,8 +973,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 */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_NAME, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, size, name, &ret_value) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, size, name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get name") done: @@ -1025,8 +1012,7 @@ H5Aget_storage_size(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an attribute") /* Get the storage size */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_STORAGE_SIZE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, 0, "unable to get acpl") done: @@ -1065,8 +1051,7 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo) loc_params.obj_type = H5I_get_type(attr_id); /* Get the attribute information */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_INFO, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: @@ -1122,8 +1107,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 information */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_INFO, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo, attr_name) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: @@ -1186,8 +1170,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 information */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_INFO, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo) < 0) + if(H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") done: @@ -1238,10 +1221,9 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") /* Rename the attribute */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_RENAME, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_name, new_name)) < 0) + if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_name, new_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - } + } /* end if */ done: FUNC_LEAVE_API(ret_value) @@ -1299,10 +1281,9 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Rename the attribute */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_RENAME, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_attr_name, new_attr_name)) < 0) + if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_attr_name, new_attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - } + } /* end if */ done: FUNC_LEAVE_API(ret_value) @@ -1377,9 +1358,7 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Iterate over attributes */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_ITER, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - idx_type, order, idx, op, op_data)) < 0) + if((ret_value = H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); done: @@ -1467,9 +1446,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Iterate over attributes */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_ITER, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - idx_type, order, idx, op, op_data)) < 0) + if((ret_value = H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "attribute iteration failed"); done: @@ -1522,8 +1499,7 @@ H5Adelete(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_DELETE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name)) < 0) + if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1581,8 +1557,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 */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_DELETE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name)) < 0) + if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1652,8 +1627,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(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_DELETE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, NULL)) < 0) + if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, NULL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1731,8 +1705,7 @@ H5Aexists(hid_t obj_id, const char *attr_name) loc_params.obj_type = H5I_get_type(obj_id); /* Check if the attribute exists */ - if(H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_EXISTS, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0) + if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: @@ -1786,8 +1759,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 */ - if(H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_EXISTS, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0) + if(H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index cce9316..af3ab4d 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -114,8 +114,8 @@ hid_t H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id) { - void *attr = NULL; /* attr token from VOL plugin */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *attr = NULL; /* attr token from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; H5P_genplist_t *plist; /* Property list pointer */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -156,18 +156,17 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the attribute */ - if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, - acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_create(vol_obj, loc_params, name, acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") /* Register the new attribute and get an ID for it */ - if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: /* Clean up on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -199,8 +198,8 @@ done: hid_t H5Aopen_name(hid_t loc_id, const char *name) { - void *attr = NULL; /* attr token from VOL plugin */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *attr = NULL; /* attr token from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -218,22 +217,21 @@ H5Aopen_name(hid_t loc_id, const char *name) loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if (NULL == (vol_obj = H5VL_vol_object(loc_id))) + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if (NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls, - name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_open(vol_obj, loc_params, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ - if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Clean up on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -265,8 +263,8 @@ done: hid_t H5Aopen_idx(hid_t loc_id, unsigned idx) { - void *attr = NULL; /* attr token from VOL plugin */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *attr = NULL; /* attr token from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -291,18 +289,17 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls, - NULL, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (attr = H5VL_attr_open(vol_obj, loc_params, NULL, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ - if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") + if((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Clean up on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -330,7 +327,7 @@ done: int H5Aget_num_attrs(hid_t loc_id) { - H5VL_object_t *vol_obj; + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; H5O_info_t oinfo; int ret_value = -1; @@ -341,13 +338,12 @@ H5Aget_num_attrs(hid_t loc_id) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); - /* get the location object */ + /* Get the location object */ if(NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Get the number of attributes for the object */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, &oinfo, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, &oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute count for object") H5_CHECKED_ASSIGN(ret_value, int, oinfo.num_attrs, hsize_t); @@ -397,18 +393,23 @@ done: herr_t H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data) { - herr_t ret_value; /* Return value */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + herr_t ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(H5_ITER_ERROR) H5TRACE4("e", "i*Iux*x", loc_id, attr_num, op, op_data); /* check arguments */ if(H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "location is not valid for an attribute") + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier") /* Call attribute iteration routine */ - if((ret_value = H5A__iterate_old(loc_id, attr_num, op, op_data)) < 0) - HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); + if((ret_value = H5VL_attr_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_ATTR_ITERATE_OLD, loc_id, attr_num, op, op_data)) < 0) + HERROR(H5E_VOL, H5E_BADITER, "error iterating over attributes"); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Aint.c b/src/H5Aint.c index ca5cb80..6502fa4 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -43,7 +43,6 @@ #include "H5Opkg.h" /* Object headers */ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VLnative_private.h" /* Native VOL driver */ /****************/ @@ -924,7 +923,7 @@ H5A__get_type(H5A_t *attr) * two level IDs, where the VOL object is a copy of the * returned datatype */ - if ((ret_value = H5VL_native_register(H5I_DATATYPE, dt, TRUE)) < 0) + if ((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") } else { @@ -1156,7 +1155,7 @@ H5A__close_cb(H5VL_object_t *attr_vol_obj) HDassert(attr_vol_obj); /* Close the attribute */ - if((ret_value = H5VL_attr_close(attr_vol_obj->data, attr_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if((ret_value = H5VL_attr_close(attr_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "problem closing attribute") /* Free the VOL object */ @@ -2621,7 +2620,7 @@ H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5 H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ - hid_t obj_loc_id = (-1); /* ID for object located */ + hid_t obj_loc_id = H5I_INVALID_HID; /* ID for object located */ H5A_attr_iter_op_t attr_op; /* Attribute operator */ void *temp_obj = NULL; H5I_type_t obj_type; @@ -2648,7 +2647,7 @@ H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5 HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object"); /* Get an ID for the object */ - if((obj_loc_id = H5VL_native_register(obj_type, temp_obj, TRUE)) < 0) + if((obj_loc_id = H5VL_wrap_register(obj_type, temp_obj, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype"); /* Call internal attribute iteration routine */ @@ -2660,7 +2659,7 @@ done: if(obj_loc_id != H5I_INVALID_HID) { if(H5I_dec_app_ref(obj_loc_id) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object"); - } + } /* end if */ else if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location"); @@ -2689,7 +2688,7 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, hsize_t idx; /* Index of attribute to start iterating at */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_PACKAGE_NOERR /* Build attribute operator info */ attr_op.op_type = H5A_ATTR_OP_APP; @@ -2700,13 +2699,12 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, /* Call internal attribute iteration routine */ if((ret_value = H5A__iterate_common(loc_id, H5_INDEX_CRT_ORDER, H5_ITER_INC, &idx, &attr_op, op_data)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") + HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); /* Translate hsize_t index value to legacy unsigned index value*/ if(attr_num) *attr_num = (unsigned)idx; -done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__iterate_old() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Apkg.h b/src/H5Apkg.h index 91061cd..12e0857 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -155,6 +155,13 @@ typedef struct { H5A_t **attrs; /* Pointer to array of attribute pointers */ } H5A_attr_table_t; +/* Types for optional attribute VOL operations */ +typedef enum H5VL_attr_optional_t { +#ifndef H5_NO_DEPRECATED_SYMBOLS + H5VL_ATTR_ITERATE_OLD /* H5Aiterate (deprecated routine) */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ +} H5VL_attr_optional_t; + /*****************************/ /* Package Private Variables */ @@ -125,7 +125,6 @@ (*head)->ctx.H5_GLUE(PROP_FIELD,_set) = TRUE; \ } /* end if */ \ } -#endif /* H5_HAVE_PARALLEL */ /* Macro for the duplicated code to test and set properties for a property list */ #define H5CX_SET_PROP(PROP_NAME, PROP_FIELD) \ @@ -140,6 +139,7 @@ if(H5P_set((*head)->ctx.dxpl, PROP_NAME, &(*head)->ctx.PROP_FIELD) < 0) \ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTSET, NULL, "error setting filter mask xfer property") \ } /* end if */ +#endif /* H5_HAVE_PARALLEL */ /******************/ @@ -267,6 +267,10 @@ typedef struct H5CX_t { /* Cached LAPL properties */ size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */ hbool_t nlinks_valid; /* Whether number of soft / UD links to traverse is valid */ + + /* Cached VOL properties */ + void *vol_wrap_ctx; /* VOL plugin's "wrap context" for creating IDs */ + hbool_t vol_wrap_ctx_valid; /* Whether VOL plugin's "wrap context" for creating IDs is valid */ } H5CX_t; /* Typedef for nodes on the API context stack */ @@ -918,6 +922,40 @@ done: /*------------------------------------------------------------------------- + * Function: H5CX_set_vol_wrap_ctx + * + * Purpose: Sets the VOL object wrapping context for an operation. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Quincey Koziol + * October 14, 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_set_vol_wrap_ctx(void *vol_wrap_ctx) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(head && *head); + + /* Set the API context value */ + (*head)->ctx.vol_wrap_ctx = vol_wrap_ctx; + + /* Mark the value as valid */ + (*head)->ctx.vol_wrap_ctx_valid = TRUE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_set_vol_wrap_ctx() */ + + +/*------------------------------------------------------------------------- * Function: H5CX_get_dxpl * * Purpose: Retrieves the DXPL ID for the current API call context. @@ -970,6 +1008,42 @@ H5CX_get_lapl(void) /*------------------------------------------------------------------------- + * Function: H5CX_get_vol_wrap_ctx + * + * Purpose: Retrieves the VOL object wrapping context for an operation. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Quincey Koziol + * October 14, 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_get_vol_wrap_ctx(void **vol_wrap_ctx) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_wrap_ctx); + HDassert(head && *head); + + /* Check for value that was set */ + if((*head)->ctx.vol_wrap_ctx_valid) + /* Get the value */ + *vol_wrap_ctx = (*head)->ctx.vol_wrap_ctx; + else + *vol_wrap_ctx = NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_get_vol_wrap_ctx() */ + + +/*------------------------------------------------------------------------- * Function: H5CX_get_tag * * Purpose: Retrieves the object tag for the current API call context. @@ -2501,7 +2575,9 @@ H5CX__pop_common(void) ret_value = (*head); (*head) = (*head)->next; +#ifdef H5_HAVE_PARALLEL done: +#endif /* H5_HAVE_PARALLEL */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5CX__pop_common() */ diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h index 44a4067..57ca5cd 100644 --- a/src/H5CXprivate.h +++ b/src/H5CXprivate.h @@ -63,10 +63,12 @@ H5_DLL void H5CX_set_lapl(hid_t lapl_id); H5_DLL herr_t H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t loc_id, hbool_t is_collective); H5_DLL herr_t H5CX_set_loc(hid_t loc_id); +H5_DLL herr_t H5CX_set_vol_wrap_ctx(void *wrap_ctx); /* "Getter" routines for API context info */ H5_DLL hid_t H5CX_get_dxpl(void); H5_DLL hid_t H5CX_get_lapl(void); +H5_DLL herr_t H5CX_get_vol_wrap_ctx(void **wrap_ctx); H5_DLL haddr_t H5CX_get_tag(void); H5_DLL H5AC_ring_t H5CX_get_ring(void); #ifdef H5_HAVE_PARALLEL diff --git a/src/H5Cquery.c b/src/H5Cquery.c index 6c927b0..e4f3133 100644 --- a/src/H5Cquery.c +++ b/src/H5Cquery.c @@ -472,11 +472,11 @@ H5C_get_mdc_image_info(H5C_t * cache_ptr, haddr_t *image_addr, hsize_t *image_le if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry") - if(image_addr == NULL || image_len == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad image_addr or image_len on entry") - *image_addr = cache_ptr->image_addr; - *image_len = cache_ptr->image_len; + if(image_addr) + *image_addr = cache_ptr->image_addr; + if(image_len) + *image_len = cache_ptr->image_len; done: FUNC_LEAVE_NOAPI(ret_value) @@ -158,17 +158,16 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, loc_params.obj_type = H5I_get_type(loc_id); /* Create the dataset */ - if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->driver->cls, - name, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_create(vol_obj, loc_params, name, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ - if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle") + if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle") done: if(H5I_INVALID_HID == ret_value) - if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) @@ -211,7 +210,7 @@ hid_t H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id) { - void *dset = NULL; /* dset token from VOL plugin */ + void *dset = NULL; /* dset token from VOL connector */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; H5P_genplist_t *plist; /* Property list pointer */ @@ -250,19 +249,17 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, loc_params.obj_type = H5I_get_type(loc_id); /* Create the dataset */ - if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->driver->cls, - NULL, dcpl_id, dapl_id, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_create(vol_obj, loc_params, NULL, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ - if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") + if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(dset && H5VL_dataset_close (dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) @@ -287,7 +284,7 @@ done: hid_t H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) { - void *dset = NULL; /* dset token from VOL plugin */ + void *dset = NULL; /* dset token from VOL connector */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -314,18 +311,18 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) loc_params.obj_type = H5I_get_type(loc_id); /* Open the dataset */ - if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->driver->cls, name, - dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_open(vol_obj, loc_params, name, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") /* Register an atom for the dataset */ - if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") + if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: if(H5I_INVALID_HID == ret_value) - if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") + FUNC_LEAVE_API(ret_value) } /* end H5Dopen2() */ @@ -391,8 +388,7 @@ H5Dget_space(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") /* Get the dataspace */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace") done: @@ -423,8 +419,7 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* Get dataspace status */ - if((ret_value = H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE_STATUS, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, allocation)) < 0) + if((ret_value = H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE_STATUS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, allocation)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get space status") done: @@ -459,8 +454,7 @@ H5Dget_type(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") /* get the datatype */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_TYPE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype") done: @@ -498,8 +492,7 @@ H5Dget_create_plist(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") /* Get the dataset creation property list */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_DCPL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_DCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset creation properties") done: @@ -554,8 +547,7 @@ H5Dget_access_plist(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") /* Get the dataset access property list */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_DAPL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_DAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset access properties") done: @@ -592,8 +584,7 @@ H5Dget_storage_size(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier") /* Get the storage size */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_STORAGE_SIZE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "unable to get storage size") done: @@ -626,8 +617,7 @@ H5Dget_offset(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier") /* Get the offset */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_OFFSET, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_OFFSET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, HADDR_UNDEF, "unable to get offset") done: @@ -840,8 +830,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, vlen_bufsize.mspace_id = H5I_INVALID_HID; /* Get a copy of the dataset's dataspace */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0) + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace") /* Create a scalar for the memory dataspace */ @@ -922,8 +911,7 @@ H5Dset_extent(hid_t dset_id, const hsize_t size[]) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Set the extent */ - if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_SET_EXTENT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, size)) < 0) + if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, size)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set dataset extent") done: @@ -961,8 +949,7 @@ H5Dflush(hid_t dset_id) * XXX: Note that we need to pass the ID to the VOL since the H5F_flush_cb_t * callback needs it and that's in the public API. */ - if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_FLUSH, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) + if((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset") done: @@ -997,8 +984,7 @@ H5Drefresh(hid_t dset_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Refresh the dataset object */ - if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_REFRESH, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) + if((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset") done: @@ -1041,8 +1027,7 @@ H5Dformat_convert(hid_t dset_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Convert the dataset */ - if(H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_DATASET_FORMAT_CONVERT) < 0) + if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_FORMAT_CONVERT) < 0) HGOTO_ERROR(H5E_DATASET, H5E_INTERNAL, FAIL, "can't convert dataset format") done: @@ -1078,8 +1063,7 @@ H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL") /* Get the chunk indexing type */ - if(H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_INDEX_TYPE, idx_type) < 0) + if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_INDEX_TYPE, idx_type) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk index type") done: @@ -1120,8 +1104,7 @@ H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_n HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "chunk_nbytes parameter cannot be NULL") /* Get the dataset creation property list */ - if(H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_STORAGE_SIZE, offset, chunk_nbytes) < 0) + if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_STORAGE_SIZE, offset, chunk_nbytes) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk") done: diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 58238bc..d778e83 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -40,7 +40,7 @@ #include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ -#include "H5VLprivate.h" /* VOL plugins */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -113,7 +113,7 @@ hid_t H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id) { - void *dset = NULL; /* dset token from VOL plugin */ + void *dset = NULL; /* dset token from VOL connector */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; H5P_genplist_t *plist; /* Property list pointer */ @@ -161,17 +161,16 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the dataset through the VOL */ - if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, dcpl_id, - H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_create(vol_obj, loc_params, name, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ - if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") + if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: if (H5I_INVALID_HID == ret_value) - if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) @@ -198,7 +197,7 @@ done: hid_t H5Dopen1(hid_t loc_id, const char *name) { - void *dset = NULL; /* dset token from VOL plugin */ + void *dset = NULL; /* dset token from VOL connector */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -221,17 +220,16 @@ H5Dopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the dataset */ - if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->driver->cls, name, - H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dset = H5VL_dataset_open(vol_obj, loc_params, name, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") /* Get an atom for the dataset */ - if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") + if((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: if(H5I_INVALID_HID == ret_value) - if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) @@ -275,8 +273,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") /* Get the dataspace pointer for the dataset */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &sid) < 0) + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &sid) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataspace") if(H5I_INVALID_HID == sid) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "received an invalid dataspace from the dataset") @@ -306,8 +303,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[]) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Increase size */ - if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_SET_EXTENT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_dims)) < 0) + if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_dims)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to extend dataset") done: diff --git a/src/H5Dint.c b/src/H5Dint.c index 253d005..6bb3343 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -21,17 +21,16 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5FOprivate.h" /* File objects */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VLnative_private.h" /* Native VOL driver */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -301,7 +300,7 @@ H5D__close_cb(H5VL_object_t *dset_vol_obj) HDassert(dset_vol_obj); /* Close the dataset */ - if(H5VL_dataset_close(dset_vol_obj->data, dset_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_dataset_close(dset_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset"); done: @@ -975,7 +974,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, /* Get the dataset's datatype */ if(NULL == (dt = (const H5T_t *)H5I_object(type_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") - /* If this is a named datatype, get the pointer via the VOL driver */ + /* If this is a named datatype, get the pointer via the VOL plugin */ type = (const H5T_t *)H5T_get_actual_type(dt); /* Check if the datatype is "sensible" for use in a dataset */ @@ -1962,12 +1961,12 @@ H5D_oloc(H5D_t *dataset) *------------------------------------------------------------------------- */ H5G_name_t * -H5D_nameof(H5D_t *dataset) +H5D_nameof(const H5D_t *dataset) { /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(dataset ? &(dataset->path) : (H5G_name_t *)NULL) + FUNC_LEAVE_NOAPI(dataset ? (H5G_name_t *)&(dataset->path) : (H5G_name_t *)NULL) } /* end H5D_nameof() */ @@ -2460,10 +2459,7 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, 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(vol_obj->data, vol_obj->driver->cls, - type_id, vlen_bufsize->mspace_id, - vlen_bufsize->fspace_id, H5P_DATASET_XFER_DEFAULT, - vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0) + if(H5VL_dataset_read(vol_obj, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, H5P_DATASET_XFER_DEFAULT, vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point") done: @@ -3402,13 +3398,12 @@ H5D__get_type(const H5D_t *dset) * two-level IDs, where the VOL object is a copy of the * returned datatype. */ - if((ret_value = H5VL_native_register(H5I_DATATYPE, dt, TRUE)) < 0) + if((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") - } - else { + } /* end if */ + else if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") - } done: if(ret_value < 0) diff --git a/src/H5Dio.c b/src/H5Dio.c index b6d4f1b..f977b0e 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -191,8 +191,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, H5CX_set_dxpl(dxpl_id); /* Read the data */ - if ((ret_value = H5VL_dataset_read(vol_obj->data, vol_obj->driver->cls, mem_type_id, mem_space_id, - file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0) + if ((ret_value = H5VL_dataset_read(vol_obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data") done: @@ -243,8 +242,7 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil H5CX_set_dxpl(dxpl_id); /* Read the raw chunk */ - if (H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, dxpl_id, - H5_REQUEST_NULL, H5VL_DATASET_CHUNK_READ, offset, filters, buf) < 0) + if(H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_DATASET_CHUNK_READ, offset, filters, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data") done: @@ -315,8 +313,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, H5CX_set_dxpl(dxpl_id); /* Write the data */ - if ((ret_value = H5VL_dataset_write(vol_obj->data, vol_obj->driver->cls, mem_type_id, mem_space_id, - file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0) + if ((ret_value = H5VL_dataset_write(vol_obj, 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") done: @@ -373,8 +370,7 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of H5CX_set_dxpl(dxpl_id); /* Write chunk */ - if (H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, dxpl_id, - H5_REQUEST_NULL, H5VL_DATASET_CHUNK_WRITE, filters, offset, data_size_32, buf) < 0) + if(H5VL_dataset_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_DATASET_CHUNK_WRITE, filters, offset, data_size_32, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data") done: diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index c84c245..30652a5 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -110,7 +110,7 @@ typedef struct H5D_type_info_t { hbool_t bkg_buf_allocated; /* Whether the background buffer was allocated */ } H5D_type_info_t; -/* types for dataset optional VOL operations */ +/* Types for dataset optional VOL operations */ typedef enum H5VL_dataset_optional_t { H5VL_DATASET_FORMAT_CONVERT, /* H5Dformat_convert (internal) */ H5VL_DATASET_GET_CHUNK_INDEX_TYPE, /* H5Dget_chunk_index_type */ diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index cbee0de..4e9cda8 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -158,7 +158,7 @@ H5_DLL herr_t H5D_close(H5D_t *dataset); H5_DLL herr_t H5D_mult_refresh_close(hid_t dset_id); H5_DLL herr_t H5D_mult_refresh_reopen(H5D_t *dataset); H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset); -H5_DLL H5G_name_t *H5D_nameof(H5D_t *dataset); +H5_DLL H5G_name_t *H5D_nameof(const H5D_t *dataset); H5_DLL H5T_t *H5D_typeof(const H5D_t *dset); H5_DLL herr_t H5D_flush_all(const H5F_t *f); H5_DLL hid_t H5D_get_create_plist(const H5D_t *dset); diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index c7c1eec..feb836d 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -2963,7 +2963,6 @@ static herr_t H5D__virtual_refresh_source_dset(H5D_t **dset) { hid_t temp_id = H5I_INVALID_HID; /* Temporary dataset identifier */ - hid_t native_vol_id = H5I_INVALID_HID; /* ID for the native VOL driver */ H5VL_object_t *vol_obj = NULL; /* VOL object stored with the ID */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2972,12 +2971,8 @@ H5D__virtual_refresh_source_dset(H5D_t **dset) /* Sanity check */ HDassert(dset && *dset); - /* Get the native VOL driver's ID */ - if((native_vol_id = H5VL_native_get_driver_id()) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get native VOL driver ID") - /* Get a temporary identifier for this source dataset */ - if((temp_id = H5VL_register_using_vol_id(H5I_DATASET, *dset, native_vol_id, FALSE)) < 0) + if((temp_id = H5VL_wrap_register(H5I_DATASET, *dset, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register (temporary) source dataset ID") /* Refresh source dataset */ @@ -2987,7 +2982,8 @@ H5D__virtual_refresh_source_dset(H5D_t **dset) /* Discard the identifier & replace the dataset */ if(NULL == (vol_obj = (H5VL_object_t *)H5I_remove(temp_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't unregister source dataset ID") - *dset = (H5D_t *)(vol_obj->data); + if(NULL == (*dset = (H5D_t *)H5VL_object_data(vol_obj))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve library object from VOL object") vol_obj->data = NULL; done: @@ -2995,7 +2991,7 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to free VOL object") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__virtual_refresh_source_dsets() */ +} /* end H5D__virtual_refresh_source_dset() */ /*------------------------------------------------------------------------- diff --git a/src/H5ESpublic.h b/src/H5ESpublic.h index cb8eebf..2df1a6e 100644 --- a/src/H5ESpublic.h +++ b/src/H5ESpublic.h @@ -29,7 +29,7 @@ typedef enum H5ES_status_t { H5ES_STATUS_IN_PROGRESS, /* Operation has not yet completed */ H5ES_STATUS_SUCCEED, /* Operation has completed, successfully */ H5ES_STATUS_FAIL, /* Operation has completed, but failed */ - H5ES_STATUS_CANCEL /* Operation has not completed and has been cancelled */ + H5ES_STATUS_CANCELLED /* Operation has not completed and was cancelled */ } H5ES_status_t; @@ -199,7 +199,7 @@ H5F__close_cb(H5VL_object_t *file_vol_obj) HDassert(file_vol_obj); /* Close the file */ - if(H5VL_file_close(file_vol_obj->data, file_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_file_close(file_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file"); /* Free the VOL object */ @@ -239,8 +239,7 @@ H5Fget_create_plist(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Retrieve the file creation property list */ - if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_FCPL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_FCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "unable to retrieve file creation properties") done: @@ -280,8 +279,7 @@ H5Fget_access_plist(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Retrieve the file's access property list */ - if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_FAPL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_FAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list") done: @@ -350,8 +348,7 @@ H5Fget_obj_count(hid_t file_id, unsigned types) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file id") /* Get the count */ - if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_OBJ_COUNT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, &ret_value) < 0) + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_OBJ_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object count in file(s)") } /* If we passed in the 'special' ID, get the count for everything open in the @@ -462,10 +459,9 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the IDs */ - if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_OBJ_IDS, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0) + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_OBJ_IDS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object ids in file(s)") - } + } /* end if */ /* If we passed in the 'special' ID, get the count for everything open in the * library, iterating over all open files and getting the object count for each. * @@ -484,24 +480,24 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) if(types & H5F_OBJ_FILE) { if(H5I_iterate(H5I_FILE, H5F__get_all_ids_cb, &udata, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed"); - } + } /* end if */ if(types & H5F_OBJ_DATASET) { if(H5I_iterate(H5I_DATASET, H5F__get_all_ids_cb, &udata, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed"); - } + } /* end if */ if(types & H5F_OBJ_GROUP) { if(H5I_iterate(H5I_GROUP, H5F__get_all_ids_cb, &udata, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed"); - } + } /* end if */ if(types & H5F_OBJ_DATATYPE) { if(H5I_iterate(H5I_DATATYPE, H5F__get_all_ids_cb, &udata, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed"); - } + } /* end if */ if(types & H5F_OBJ_ATTR) { if(H5I_iterate(H5I_ATTR, H5F__get_all_ids_cb, &udata, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed"); - } - } + } /* end if */ + } /* end else */ done: FUNC_LEAVE_API(ret_value) @@ -536,8 +532,7 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Retrieve the VFD handle for the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl_id) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle") done: @@ -574,8 +569,7 @@ H5Fis_accessible(const char *name, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") /* Check if file is accessible */ - if(H5VL_file_specific(NULL, NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, fapl_id, name, &ret_value) < 0) + if(H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id, name, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5") done: @@ -614,9 +608,8 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) void *new_file = NULL; /* file struct for new file */ H5P_genplist_t *plist; /* Property list pointer */ - H5VL_class_t *cls = NULL; /* VOL Class structure for callback info */ - H5VL_t *driver = NULL; /* VOL driver struct */ - H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ + H5VL_class_t *cls = NULL; /* VOL Class structure for callback info */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -650,10 +643,10 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* get the VOL info from the fapl */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get vol driver info") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL driver ID") + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL connector ID") /* Adjust bit flags by turning on the creation bit and making sure that * the EXCL or TRUNC bit is set. All newly-created files are opened for @@ -664,21 +657,12 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; /* Create a new file or truncate an existing file through the VOL */ - if(NULL == (new_file = H5VL_file_create(cls, filename, flags, fcpl_id, fapl_id, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (new_file = H5VL_file_create(cls, filename, flags, fcpl_id, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file") - /* Setup VOL driver struct */ - if(NULL == (driver = H5FL_CALLOC(H5VL_t))) - HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VL info struct") - driver->cls = cls; - driver->id = driver_prop.driver_id; - if(H5I_inc_ref(driver->id, FALSE) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver") - /* Get an atom for the file */ - if((ret_value = H5VL_register(H5I_FILE, new_file, driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") + if((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: FUNC_LEAVE_API(ret_value) @@ -709,9 +693,8 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { void *new_file = NULL; /* file struct for new file */ H5P_genplist_t *plist; /* Property list pointer */ - H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ H5VL_class_t *cls = NULL; /* VOL class structure for callback info */ - H5VL_t *driver = NULL; /* VOL driver struct */ hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -739,26 +722,18 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) /* Get the VOL info from the fapl */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL driver info") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL driver ID") + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL connector ID") /* Open the file through the VOL layer */ if(NULL == (new_file = H5VL_file_open(cls, filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") - /* Setup VOL driver struct */ - if(NULL == (driver = H5FL_CALLOC(H5VL_t))) - HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VL info struct") - driver->cls = cls; - driver->id = driver_prop.driver_id; - if(H5I_inc_ref(driver->id, FALSE) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver") - /* Get an ID for the file */ - if((ret_value = H5VL_register(H5I_FILE, new_file, driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") + if((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: FUNC_LEAVE_API(ret_value) @@ -789,17 +764,15 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) /* Get the type of object we're flushing + sanity check */ obj_type = H5I_get_type(object_id); if(H5I_FILE != obj_type && H5I_GROUP != obj_type && H5I_DATATYPE != obj_type && - H5I_DATASET != obj_type && H5I_ATTR != obj_type) { + H5I_DATASET != obj_type && H5I_ATTR != obj_type) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - } /* get the file object */ if(NULL == (vol_obj = H5VL_vol_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Flush the object */ - if(H5VL_file_specific(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_FLUSH, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, scope) < 0) + if(H5VL_file_specific(vol_obj, H5VL_FILE_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, scope) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file") done: @@ -863,7 +836,7 @@ hid_t H5Freopen(hid_t file_id) { H5VL_object_t *vol_obj = NULL; - void *file; /* File token from VOL driver */ + void *file; /* File token from VOL connector */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -874,17 +847,16 @@ H5Freopen(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Reopen the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_REOPEN, &file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL driver") + if(H5VL_file_specific(vol_obj, H5VL_FILE_REOPEN, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &file) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL connector") /* Make sure that worked */ if(NULL == file) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file") /* Get an atom for the file */ - if((ret_value = H5VL_register(H5I_FILE, file, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") + if((ret_value = H5VL_register(H5I_FILE, file, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: /* XXX (VOL MERGE): If registration fails, file will not be closed */ @@ -919,10 +891,9 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Get the flags */ - if((ret_value = H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_INTENT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, intent_flags)) < 0) + if((ret_value = H5VL_file_get(vol_obj, H5VL_FILE_GET_INTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, intent_flags)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's intent flags") - } + } /* end if */ done: FUNC_LEAVE_API(ret_value) @@ -954,8 +925,7 @@ H5Fget_freespace(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the amount of free space in the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space") done: @@ -990,8 +960,7 @@ H5Fget_filesize(hid_t file_id, hsize_t *size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the file size */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_GET_SIZE, size) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_SIZE, size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") done: @@ -1041,8 +1010,8 @@ done: ssize_t H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len) { - H5VL_object_t *vol_obj; /* File object for file ID */ - ssize_t ret_value; /* Return value */ + H5VL_object_t *vol_obj; /* File object for file ID */ + ssize_t ret_value; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE3("Zs", "i*xz", file_id, buf_ptr, buf_len); @@ -1052,8 +1021,7 @@ H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID") /* Get the file image */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - H5VL_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image") done: @@ -1093,8 +1061,7 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Get the metadata cache configuration */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_GET_MDC_CONF, config_ptr) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_CONF, config_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration") done: @@ -1127,8 +1094,7 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Set the metadata cache configuration */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_SET_MDC_CONFIG, config_ptr) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_MDC_CONFIG, config_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration") done: @@ -1164,8 +1130,7 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the current hit rate */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate") done: @@ -1202,9 +1167,7 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the size data */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_GET_MDC_SIZE, - max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, 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_FILE, H5E_CANTGET, FAIL, "unable to get MDC size") done: @@ -1242,8 +1205,7 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Reset the hit rate statistic */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_RESET_MDC_HIT_RATE) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_RESET_MDC_HIT_RATE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate") done: @@ -1277,7 +1239,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) { H5VL_object_t *vol_obj = NULL; H5I_type_t type; - ssize_t ret_value = -1; + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE3("Zs", "ixz", obj_id, name, size); @@ -1292,8 +1254,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the filename via the VOL */ - if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_NAME, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, size, name, &ret_value) < 0) + if(H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, size, name, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file name") done: @@ -1338,8 +1299,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the file information */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - H5VL_FILE_GET_INFO, type, finfo) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, finfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") done: @@ -1375,8 +1335,7 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the retry info */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_GET_METADATA_READ_RETRY_INFO, info) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_METADATA_READ_RETRY_INFO, info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't get metadata read retry info") done: @@ -1415,8 +1374,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0") /* Get the free-space section information in the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - H5VL_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, type, nsects) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, type, nsects) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections") done: @@ -1449,8 +1407,7 @@ H5Fclear_elink_file_cache(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Release the EFC */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_CLEAR_ELINK_CACHE) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_CLEAR_ELINK_CACHE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") done: @@ -1509,9 +1466,8 @@ H5Fstart_swmr_write(hid_t file_id) if(H5CX_set_loc(file_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* start SWMR writing */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_START_SWMR_WRITE) < 0) + /* Start SWMR writing */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_START_SWMR_WRITE) < 0) HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing") done: @@ -1543,8 +1499,7 @@ H5Fstart_mdc_logging(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_START_MDC_LOGGING) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_START_MDC_LOGGING) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to start mdc logging") done: @@ -1577,8 +1532,7 @@ H5Fstop_mdc_logging(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_STOP_MDC_LOGGING) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_STOP_MDC_LOGGING) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging") done: @@ -1612,8 +1566,7 @@ H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status") done: @@ -1633,13 +1586,10 @@ done: * *------------------------------------------------------------------------- */ -/* XXX (VOL MERGE): This could go in the native VOL driver under 'optional' - */ herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) { H5VL_object_t *vol_obj; /* File as VOL object */ - H5F_t *f; /* File */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1648,15 +1598,14 @@ H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) /* Check args */ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID") - f = (H5F_t *)(vol_obj->data); /* Set up collective metadata if appropriate */ if(H5CX_set_loc(file_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal set_libver_bounds function */ - if(H5F__set_libver_bounds(f, low, high) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds") + /* Set the library's version bounds */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds") done: FUNC_LEAVE_API(ret_value) @@ -1692,8 +1641,7 @@ H5Fformat_convert(hid_t file_id) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Convert the format */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_FORMAT_CONVERT) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_FORMAT_CONVERT) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format") done: @@ -1724,8 +1672,7 @@ H5Freset_page_buffering_stats(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Reset the statistics */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_RESET_PAGE_BUFFERING_STATS) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_RESET_PAGE_BUFFERING_STATS) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering") done: @@ -1760,9 +1707,7 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2 HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL input parameters for stats") /* Get the statistics */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_GET_PAGE_BUFFERING_STATS, - accesses, hits, misses, evictions, bypasses) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_PAGE_BUFFERING_STATS, accesses, hits, misses, evictions, bypasses) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering") done: @@ -1786,21 +1731,19 @@ done: herr_t H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_len) { - H5F_t *file; /* File object for file ID */ + H5VL_object_t *vol_obj; /* File info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*a*h", file_id, image_addr, image_len); /* Check args */ - if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - if(NULL == image_addr || NULL == image_len) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL image addr or image len") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Go get the address and size of the cache image */ - if(H5AC_get_mdc_image_info(file->shared->cache, image_addr, image_len) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't retrieve cache image info") + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_IMAGE_INFO, image_addr, image_len) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info") done: FUNC_LEAVE_API(ret_value) @@ -1820,29 +1763,23 @@ done: herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa) { - H5F_t *file; /* File object for file ID */ - haddr_t rel_eoa; /* Relative address of EOA */ + H5VL_object_t *vol_obj; /* File info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*a", file_id, eoa); /* Check args */ - if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") - /* This public routine will work only for drivers with this feature enabled.*/ - /* We might introduce a new feature flag in the future */ - if(!H5F_HAS_FEATURE(file, H5FD_FEAT_SUPPORTS_SWMR_IO)) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine") - - /* The real work */ - if(HADDR_UNDEF == (rel_eoa = H5FD_get_eoa(file->shared->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get_eoa request failed") + /* Only do work if valid pointer to fill in */ + if(eoa) { + /* Retrieve the EOA for the file */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_EOA, eoa) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get EOA") + } /* end if */ - /* (Note compensating for base address subtraction in internal routine) */ - if(eoa) - *eoa = rel_eoa + H5FD_get_base_addr(file->shared->lf); done: FUNC_LEAVE_API(ret_value) } /* H5Fget_eoa() */ @@ -1859,30 +1796,19 @@ done: herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment) { - H5F_t *file; /* File object for file ID */ - haddr_t max_eof_eoa; /* Maximum of the relative EOA & EOF */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "ih", file_id, increment); /* Check args */ - if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") - /* This public routine will work only for drivers with this feature enabled.*/ - /* We might introduce a new feature flag in the future */ - if(!H5F_HAS_FEATURE(file, H5FD_FEAT_SUPPORTS_SWMR_IO)) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine") - - /* Get the maximum of EOA and EOF */ - if(H5F__get_max_eof_eoa(file, &max_eof_eoa) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") - - /* Set EOA to the maximum value + increment */ - /* H5FD_set_eoa() will add base_addr to max_eof_eoa */ - if(H5FD_set_eoa(file->shared->lf, H5FD_MEM_DEFAULT, max_eof_eoa + increment) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed") + /* Increment the file size */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_INCR_FILESIZE, increment) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to increment file size") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5FDtest.c b/src/H5FDtest.c index 080223c..dec0818 100644 --- a/src/H5FDtest.c +++ b/src/H5FDtest.c @@ -104,11 +104,10 @@ H5FD__supports_swmr_test(const char *vfd_name) FUNC_ENTER_NOAPI_NOINIT_NOERR - if(!vfd_name || !HDstrcmp(vfd_name, "")) + if(!vfd_name || !HDstrcmp(vfd_name, "") || !HDstrcmp(vfd_name, "nomatch")) ret_value = TRUE; else - ret_value = !HDstrcmp(vfd_name, "log") - || !HDstrcmp(vfd_name, "sec2"); + ret_value = !HDstrcmp(vfd_name, "log") || !HDstrcmp(vfd_name, "sec2"); FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index 6fee596..dfc1441 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -96,7 +96,8 @@ herr_t H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo) { - H5F_t *f; /* Top file in mount hierarchy */ + H5VL_object_t *vol_obj = NULL; + H5I_type_t type; H5F_info2_t finfo2; /* Current file info struct */ herr_t ret_value = SUCCEED; /* Return value */ @@ -107,27 +108,17 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo) if(!finfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - /* For file IDs, get the file object directly - * - * (This prevents the H5G_loc() call from returning the file pointer for - * the top file in a mount hierarchy) - */ - if(H5I_get_type(obj_id) == H5I_FILE ) { - if(NULL == (f = (H5F_t *)H5VL_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") - } - else { - H5G_loc_t loc; /* Object location */ - - /* Get symbol table entry */ - if(H5G_loc(obj_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID") - f = loc.oloc->file; - } - HDassert(f->shared); - - /* Get the current file info */ - if(H5F__get_info(f, &finfo2) < 0) + /* Check the type */ + type = H5I_get_type(obj_id); + if(H5I_FILE != type && H5I_GROUP != type && H5I_DATATYPE != type && H5I_DATASET != type && H5I_ATTR != type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Get the file object */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + + /* Get the file information */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, &finfo2) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") /* Copy the compatible fields into the older struct */ @@ -165,12 +156,11 @@ H5Fis_hdf5(const char *name) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "no file name specified") - /* call the private is_HDF5 function */ - if((ret_value = H5F__is_hdf5(name, H5P_FILE_ACCESS_DEFAULT)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, (-1), "unable open file") + /* Check if file is accessible */ + if(H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5P_FILE_ACCESS_DEFAULT, name, &ret_value) < 0) + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, (-1), "unable to determine if file is accessible as HDF5") done: - FUNC_LEAVE_API(ret_value) } /* end H5Fis_hdf5() */ @@ -209,16 +199,13 @@ done: * *------------------------------------------------------------------------- */ -/* XXX (VOL MERGE): This could go in the native VOL driver under 'optional'. - */ herr_t H5Fset_latest_format(hid_t file_id, hbool_t latest_format) { H5VL_object_t *vol_obj; /* File as VOL object */ - H5F_t *f; /* File */ - H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */ - H5F_libver_t high = H5F_LIBVER_LATEST; /* High bound */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */ + H5F_libver_t high = H5F_LIBVER_LATEST; /* High bound */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "ib", file_id, latest_format); @@ -226,17 +213,20 @@ H5Fset_latest_format(hid_t file_id, hbool_t latest_format) /* Check args */ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID") - f = (H5F_t *)(vol_obj->data); + + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(file_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* 'low' and 'high' are both initialized to LATEST. * If latest format is not expected, set 'low' to EARLIEST - */ + */ if(!latest_format) low = H5F_LIBVER_EARLIEST; - /* Call private set_libver_bounds function to set the bounds */ - if(H5F__set_libver_bounds(f, low, high) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds") + /* Set the library's version bounds */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Fint.c b/src/H5Fint.c index 1a0c8b9..c085e83 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -37,8 +37,8 @@ #include "H5Pprivate.h" /* Property lists */ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5Tprivate.h" /* Datatypes */ -#include "H5VLprivate.h" /* VOL drivers */ -#include "H5VLnative_private.h" /* Native VOL driver */ +#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5VLnative_private.h" /* Native VOL connector */ /****************/ @@ -307,11 +307,11 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id if(types & H5F_OBJ_LOCAL) { olist.file_info.local = TRUE; olist.file_info.ptr.file = f; - } + } /* end if */ else { olist.file_info.local = FALSE; olist.file_info.ptr.shared = f ? f->shared : NULL; - } + } /* end else */ /* Iterate through file IDs to count the number, and put their * IDs on the object list. */ @@ -319,7 +319,7 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id olist.obj_type = H5I_FILE; if(H5I_iterate(H5I_FILE, H5F__get_objects_cb, &olist, app_ref) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(1)") - } + } /* end if */ /* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero), * or the caller wants to get the list of IDs and the list isn't full, @@ -330,8 +330,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id olist.obj_type = H5I_DATASET; if(H5I_iterate(H5I_DATASET, H5F__get_objects_cb, &olist, app_ref) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(2)") - } - } + } /* end if */ + } /* end if */ /* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero), * or the caller wants to get the list of IDs and the list isn't full, @@ -342,8 +342,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id olist.obj_type = H5I_GROUP; if(H5I_iterate(H5I_GROUP, H5F__get_objects_cb, &olist, app_ref) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(3)") - } - } + } /* end if */ + } /* end if */ /* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero), * or the caller wants to get the list of IDs and the list isn't full, @@ -354,8 +354,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id olist.obj_type = H5I_DATATYPE; if(H5I_iterate(H5I_DATATYPE, H5F__get_objects_cb, &olist, app_ref) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(4)") - } - } + } /* end if */ + } /* end if */ /* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero), * or the caller wants to get the list of IDs and the list isn't full, @@ -366,8 +366,8 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id olist.obj_type = H5I_ATTR; if(H5I_iterate(H5I_ATTR, H5F__get_objects_cb, &olist, app_ref) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(5)") - } - } + } /* end if */ + } /* end if */ /* Set the number of objects currently open */ *obj_id_count_ptr = obj_id_count; @@ -409,8 +409,8 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) (!olist->file_info.ptr.shared || (olist->file_info.ptr.shared && ((H5F_t*)obj_ptr)->shared == olist->file_info.ptr.shared)))) { add_obj = TRUE; - } - } + } /* end if */ + } /* end if */ else { /* Either count opened object IDs or put the IDs on the list */ H5O_loc_t *oloc; /* Group entry info for object */ @@ -460,7 +460,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) (!olist->file_info.ptr.shared && olist->obj_type != H5I_DATATYPE) || (oloc && oloc->file && oloc->file->shared == olist->file_info.ptr.shared)))) { add_obj = TRUE; - } + } /* end if */ } /* end else */ if(add_obj) { @@ -468,7 +468,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) if(olist->obj_id_list) { olist->obj_id_list[olist->list_index] = obj_id; olist->list_index++; - } + } /* end if */ /* Increment the number of open objects */ if(olist->obj_id_count) @@ -481,7 +481,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) */ if(olist->max_nobjs > 0 && olist->list_index >= olist->max_nobjs) HGOTO_DONE(H5_ITER_STOP) /* Indicate that the iterator should stop */ - } + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -2166,7 +2166,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5F_get_id(H5F_t *file, hbool_t app_ref) +H5F_get_id(H5F_t *file) { hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -2175,16 +2175,16 @@ H5F_get_id(H5F_t *file, hbool_t app_ref) HDassert(file); if(H5I_find_id(file, H5I_FILE, &ret_value) < 0 || H5I_INVALID_HID == ret_value) { - /* resurrect the ID - Register an ID with the native driver */ - if((ret_value = H5VL_native_register(H5I_FILE, file, app_ref)) < 0) + /* resurrect the ID - Register an ID with the native connector */ + if((ret_value = H5VL_wrap_register(H5I_FILE, file, FALSE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") file->id_exists = TRUE; - } + } /* end if */ else { /* Increment reference count on existing ID */ - if(H5I_inc_ref(ret_value, app_ref) < 0) + if(H5I_inc_ref(ret_value, FALSE) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") - } + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -2999,6 +2999,7 @@ H5F__set_eoa(const H5F_t *f, H5F_mem_t type, haddr_t addr) HDassert(f->shared); /* Dispatch to driver */ + /* (H5FD_set_eoa() will add base_addr to addr) */ if(H5FD_set_eoa(f->shared->lf, type, addr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed") @@ -3234,7 +3235,7 @@ H5F__start_swmr_write(H5F_t *f) H5G_name_t *obj_paths = NULL; /* Group hierarchy path */ size_t u; /* Local index variable */ hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */ - H5VL_t *vol_driver = NULL; /* VOL driver for the file */ + H5VL_t *vol_connector = NULL; /* VOL connector for the file */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -3274,16 +3275,16 @@ H5F__start_swmr_write(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") /* Get the # of opened named datatypes and attributes */ - if(H5F_get_obj_count(f, H5F_OBJ_DATATYPE|H5F_OBJ_ATTR, FALSE, &nt_attr_count) < 0) + if(H5F_get_obj_count(f, H5F_OBJ_DATATYPE | H5F_OBJ_ATTR, FALSE, &nt_attr_count) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed") - if(nt_attr_count) + if(nt_attr_count > 0) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "named datatypes and/or attributes opened in the file") /* Get the # of opened datasets and groups */ - if(H5F_get_obj_count(f, H5F_OBJ_GROUP|H5F_OBJ_DATASET, FALSE, &grp_dset_count) < 0) + if(H5F_get_obj_count(f, H5F_OBJ_GROUP | H5F_OBJ_DATASET, FALSE, &grp_dset_count) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed") - if(grp_dset_count) { + if(grp_dset_count > 0) { /* Allocate space for group and object locations */ if((obj_ids = (hid_t *) H5MM_malloc(grp_dset_count * sizeof(hid_t))) == NULL) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, FAIL, "can't allocate buffer for hid_t") @@ -3298,17 +3299,20 @@ H5F__start_swmr_write(H5F_t *f) if(H5F_get_obj_ids(f, H5F_OBJ_GROUP|H5F_OBJ_DATASET, grp_dset_count, obj_ids, FALSE, &grp_dset_count) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5F_get_obj_ids failed") - /* Save the VOL driver for the refresh step */ + /* Save the VOL connector and the object wrapping context for the refresh step */ if(grp_dset_count > 0) { - H5VL_object_t *vol_obj = NULL; + H5VL_object_t *vol_obj; + /* Get the VOL object for one of the IDs */ if(NULL == (vol_obj = H5VL_vol_object(obj_ids[0]))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "invalid object identifier") - vol_driver = vol_obj->driver; - } + /* Get the (top) connector for the ID */ + vol_connector = vol_obj->connector; + } /* end if */ - /* Refresh opened objects (groups, datasets) in the file */ + /* Gather information about opened objects (groups, datasets) in the file */ + /* (For refresh later on) */ for(u = 0; u < grp_dset_count; u++) { H5O_loc_t *oloc; /* object location */ H5G_loc_t tmp_loc; @@ -3369,10 +3373,9 @@ H5F__start_swmr_write(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to evict file's cached information") /* Refresh (reopen) the objects (groups & datasets) in the file */ - for(u = 0; u < grp_dset_count; u++) { - if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], vol_driver, TRUE) < 0) + for(u = 0; u < grp_dset_count; u++) + if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], vol_connector, TRUE) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't refresh-close object") - } /* Unlock the file */ if(H5FD_unlock(f->shared->lf) < 0) @@ -3482,3 +3485,153 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F__format_convert() */ + +/*--------------------------------------------------------------------------- + * Function: H5F__get_file + * + * Purpose: Utility routine to get file struct for an object + * + * Returns: SUCCESS: A pointer to the H5F_t struct for the file + * associated with the object. + * FAILURE: NULL + * + *--------------------------------------------------------------------------- + */ +H5F_t * +H5F__get_file(void *obj, H5I_type_t type) +{ + H5F_t *ret_value = NULL; /* File pointer */ + H5O_loc_t *oloc = NULL; /* Object location for ID */ + + FUNC_ENTER_PACKAGE + + switch(type) { + case H5I_FILE: + ret_value = (H5F_t *)obj; + break; + + case H5I_GROUP: + oloc = H5G_oloc((H5G_t *)obj); + break; + + case H5I_DATATYPE: + oloc = H5T_oloc((H5T_t *)obj); + break; + + case H5I_DATASET: + oloc = H5D_oloc((H5D_t *)obj); + break; + + case H5I_ATTR: + oloc = H5A_oloc((H5A_t *)obj); + break; + + case H5I_UNINIT: + case H5I_BADID: + case H5I_DATASPACE: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_VOL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + } /* end switch */ + + /* Set return value for objects (not files) */ + if(oloc) + ret_value = oloc->file; + + /* Couldn't find a file struct */ + if(!ret_value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "object is not associated with a file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5F__get_file */ + + +/*------------------------------------------------------------------------- + * Function: H5F__get_file_id + * + * Purpose: The package version of H5Iget_file_id(), obtains the file + * ID given an object ID. + * + * Return: Success: The file ID associated with the object + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5F__get_file_id(H5F_t *file) +{ + hid_t file_id = H5I_INVALID_HID; /* File ID */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check if the file's ID already exists */ + if(H5I_find_id(file, H5I_FILE, &file_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed") + + /* If the ID does not exist, register it with the VOL connector */ + if(H5I_INVALID_HID == file_id) { + if((file_id = H5VL_wrap_register(H5I_FILE, file, TRUE)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") + file->id_exists = TRUE; + } /* end if */ + else { + /* Increment ref count on existing ID */ + if(H5I_inc_ref(file_id, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") + } /* end else */ + + /* Set return value */ + ret_value = file_id; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__get_file_id() */ + + +/*------------------------------------------------------------------------- + * Function: H5F_get_file_id + * + * Purpose: The private version of H5Iget_file_id(), obtains the file + * ID given an object ID. + * + * Return: Success: The file ID associated with the object + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5F_get_file_id(hid_t obj_id, H5I_type_t type) +{ + H5VL_object_t *vol_obj; /* File info */ + hid_t file_id = H5I_INVALID_HID; /* File ID for object */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_NOAPI(H5I_INVALID_HID) + + /* Get the object pointer */ + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier") + + /* Get the file through the VOL */ + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FILE_ID, type, &file_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file ID") + if(H5I_INVALID_HID == file_id) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file ID through the VOL") + + /* Set return value */ + ret_value = file_id; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_get_file_id() */ + diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 310edd4..d7f8915 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -477,13 +477,12 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) if(NULL == (child_vol_obj = (H5VL_object_t *)H5I_object(child_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get child object") - /* Check if both objects are associated with the same VOL plugin */ - if(loc_vol_obj->driver->cls->value != child_vol_obj->driver->cls->value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL driver") + /* Check if both objects are associated with the same VOL connector */ + if(loc_vol_obj->connector->cls->value != child_vol_obj->connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL connector") /* Perform the mount operation */ - if(H5VL_file_specific(loc_vol_obj->data, loc_vol_obj->driver->cls, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, loc_type, name, child_vol_obj->data, plist_id) < 0) + if(H5VL_file_specific(loc_vol_obj, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name, child_vol_obj->data, plist_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file") done: @@ -535,8 +534,7 @@ H5Funmount(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object") /* Perform the unmount operation */ - if(H5VL_file_specific(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_UNMOUNT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name) < 0) + if(H5VL_file_specific(vol_obj, H5VL_FILE_UNMOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file") done: diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 2098a77..990a6b9 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -383,14 +383,14 @@ typedef enum H5VL_file_optional_t { H5VL_FILE_CLEAR_ELINK_CACHE, /* Clear external link cache */ H5VL_FILE_GET_FILE_IMAGE, /* file image */ H5VL_FILE_GET_FREE_SECTIONS, /* file free selections */ - H5VL_FILE_GET_FREE_SPACE, /* file freespace */ - H5VL_FILE_GET_INFO, /* file info */ - H5VL_FILE_GET_MDC_CONF, /* file metadata cache configuration */ - H5VL_FILE_GET_MDC_HR, /* file metadata cache hit rate */ - H5VL_FILE_GET_MDC_SIZE, /* file metadata cache size */ - H5VL_FILE_GET_SIZE, /* file size */ - H5VL_FILE_GET_VFD_HANDLE, /* file VFD handle */ - H5VL_FILE_REOPEN, /* reopen the file */ + H5VL_FILE_GET_FREE_SPACE, /* file freespace */ + H5VL_FILE_GET_INFO, /* file info */ + H5VL_FILE_GET_MDC_CONF, /* file metadata cache configuration */ + H5VL_FILE_GET_MDC_HR, /* file metadata cache hit rate */ + H5VL_FILE_GET_MDC_SIZE, /* file metadata cache size */ + H5VL_FILE_GET_SIZE, /* file size */ + H5VL_FILE_GET_VFD_HANDLE, /* file VFD handle */ + H5VL_FILE_GET_FILE_ID, /* retrieve or resurrect file ID of object */ H5VL_FILE_RESET_MDC_HIT_RATE, /* get metadata cache hit rate */ H5VL_FILE_SET_MDC_CONFIG, /* set metadata cache configuration */ H5VL_FILE_GET_METADATA_READ_RETRY_INFO, @@ -398,12 +398,13 @@ typedef enum H5VL_file_optional_t { H5VL_FILE_START_MDC_LOGGING, H5VL_FILE_STOP_MDC_LOGGING, H5VL_FILE_GET_MDC_LOGGING_STATUS, - H5VL_FILE_SET_LATEST_FORMAT, H5VL_FILE_FORMAT_CONVERT, H5VL_FILE_RESET_PAGE_BUFFERING_STATS, H5VL_FILE_GET_PAGE_BUFFERING_STATS, - H5VL_FILE_GET_MDC_IMAGE_INFO - + H5VL_FILE_GET_MDC_IMAGE_INFO, + H5VL_FILE_GET_EOA, + H5VL_FILE_INCR_FILESIZE, + H5VL_FILE_SET_LIBVER_BOUNDS } H5VL_file_optional_t; /* User data for traversal routine to get ID counts */ @@ -447,6 +448,8 @@ H5_DLL herr_t H5F__format_convert(H5F_t *f); H5_DLL herr_t H5F__start_swmr_write(H5F_t *f); H5_DLL herr_t H5F__close(H5F_t *f); H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high); +H5_DLL H5F_t *H5F__get_file(void *obj, H5I_type_t type); +H5_DLL hid_t H5F__get_file_id(H5F_t *file); /* File mount related routines */ H5_DLL herr_t H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id); @@ -506,6 +509,7 @@ H5_DLL herr_t H5F__get_sohm_mesg_count_test(hid_t fid, unsigned type_id, size_t H5_DLL herr_t H5F__check_cached_stab_test(hid_t file_id); H5_DLL herr_t H5F__get_maxaddr_test(hid_t file_id, haddr_t *maxaddr); H5_DLL herr_t H5F__get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr); +H5_DLL htri_t H5F__same_file_test(hid_t file_id1, hid_t file_id2); #endif /* H5F_TESTING */ #endif /* _H5Fpkg_H */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 6595677..00aefa0 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -479,7 +479,7 @@ typedef struct H5F_t H5F_t; #define H5F_ACS_SDATA_BLOCK_SIZE_NAME "sdata_block_size" /* Minimum "small data" allocation block size (when aggregating "small" raw data allocations) */ #define H5F_ACS_GARBG_COLCT_REF_NAME "gc_ref" /* Garbage-collect references */ #define H5F_ACS_FILE_DRV_NAME "vfd_info" /* File driver ID & info */ -#define H5F_ACS_VOL_DRV_NAME "vol_driver_info" /* VOL driver ID & info */ +#define H5F_ACS_VOL_CONN_NAME "vol_connector_info" /* VOL connector ID & info */ #define H5F_ACS_CLOSE_DEGREE_NAME "close_degree" /* File close degree */ #define H5F_ACS_FAMILY_OFFSET_NAME "family_offset" /* Offset position in file for family file driver */ #define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" /* New member size of family driver. (private property only used by h5repart) */ @@ -716,6 +716,7 @@ typedef enum H5F_prefix_open_t { /* Private functions */ H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/); +H5_DLL hid_t H5F_get_file_id(hid_t obj_id, H5I_type_t id_type); /* Functions that retrieve values from the file struct */ H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f); @@ -734,7 +735,7 @@ H5_DLL H5F_t *H5F_get_parent(const H5F_t *f); H5_DLL unsigned H5F_get_nmounts(const H5F_t *f); H5_DLL unsigned H5F_get_read_attempts(const H5F_t *f); H5_DLL hid_t H5F_get_access_plist(H5F_t *f, hbool_t app_ref); -H5_DLL hid_t H5F_get_id(H5F_t *file, hbool_t app_ref); +H5_DLL hid_t H5F_get_id(H5F_t *file); H5_DLL herr_t H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref, size_t *obj_id_count_ptr); H5_DLL herr_t H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *oid_list, hbool_t app_ref, size_t *obj_id_count_ptr); H5_DLL hsize_t H5F_get_pgend_meta_thres(const H5F_t *f); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index b036974..3147e95 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -904,7 +904,7 @@ H5F_get_eoa(const H5F_t *f, H5FD_mem_t type) /* Dispatch to driver */ if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(f->shared->lf, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Ftest.c b/src/H5Ftest.c index 1183284..49a2a22 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -233,3 +233,37 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__get_sbe_addr_test() */ + +/*------------------------------------------------------------------------- + * Function: H5F__same_file_test + * + * Purpose: Check if two file IDs refer to the same underlying file. + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * Oct 13, 2018 + * + *------------------------------------------------------------------------- + */ +htri_t +H5F__same_file_test(hid_t file_id1, hid_t file_id2) +{ + H5F_t *file1, *file2; /* File info */ + htri_t ret_value = FAIL; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check arguments */ + if(NULL == (file1 = (H5F_t *)H5VL_object_verify(file_id1, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + if(NULL == (file2 = (H5F_t *)H5VL_object_verify(file_id2, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + + /* If they are using the same underlying "shared" file struct, they are the same file */ + ret_value = (file1->shared == file2->shared); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__same_file_test() */ + @@ -278,7 +278,7 @@ H5G__close_cb(H5VL_object_t *grp_vol_obj) HDassert(grp_vol_obj); /* Close the group */ - if(H5VL_group_close(grp_vol_obj->data, grp_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_group_close(grp_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to close group") /* Free the VOL object */ @@ -351,13 +351,13 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Get the gcpl structure and set the link properties on it */ - if (NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5I_INVALID_HID, "can't find object for ID") - if (H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0) + if(H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set property value for lcpl id") - /* get the location object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Set the location parameters */ @@ -365,17 +365,16 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, loc_params.obj_type = H5I_get_type(loc_id); /* Create the group */ - if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, - gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_create(vol_obj, loc_params, name, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ - if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") + if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") done: if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -440,23 +439,22 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); - /* get the location object */ + /* Get the location object */ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the group */ - if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->driver->cls, NULL, - gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_create(vol_obj, loc_params, NULL, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ - if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") + if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -482,9 +480,9 @@ hid_t H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) { void *grp = NULL; /* Group opened */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "i*si", loc_id, name, gapl_id); @@ -506,17 +504,17 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) /* Open the group */ loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); - if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->driver->cls, - name, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + + if(NULL == (grp = H5VL_group_open(vol_obj, loc_params, name, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") /* Register an ID for the group */ - if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") + if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -550,8 +548,7 @@ H5Gget_create_plist(hid_t group_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group ID") /* Get the group creation property list for the group */ - if(H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_GCPL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_GCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") done: @@ -593,8 +590,7 @@ H5Gget_info(hid_t loc_id, H5G_info_t *group_info) /* Retrieve the group's information */ loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = id_type; - if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_INFO, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) + if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info") done: @@ -636,7 +632,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info, HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the location object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Set up location parameters */ @@ -646,8 +642,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info, loc_params.obj_type = H5I_get_type(loc_id); /* Retrieve the group's information */ - if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_INFO, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) + if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -693,7 +688,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access property list info") - /* get the location object */ + /* Get the location object */ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") @@ -707,8 +702,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Retrieve the group's information */ - if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_INFO, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) + if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -779,8 +773,7 @@ H5Gflush(hid_t group_id) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Flush group's metadata to file */ - if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_FLUSH, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id)) < 0) + if(H5VL_group_specific(vol_obj, H5VL_GROUP_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group") done: @@ -818,8 +811,7 @@ H5Grefresh(hid_t group_id) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Refresh group's metadata */ - if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_REFRESH, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id)) < 0) + if(H5VL_group_specific(vol_obj, H5VL_GROUP_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") done: diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c index b32ce39..7e2b324 100644 --- a/src/H5Gcompact.c +++ b/src/H5Gcompact.c @@ -572,71 +572,3 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__compact_lookup_by_idx() */ -#ifndef H5_NO_DEPRECATED_SYMBOLS - -/*------------------------------------------------------------------------- - * Function: H5G__compact_get_type_by_idx - * - * Purpose: Returns the type of objects in the group by giving index. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * Sep 12, 2005 - * - *------------------------------------------------------------------------- - */ -H5G_obj_t -H5G__compact_get_type_by_idx(H5O_loc_t *oloc, const H5O_linfo_t *linfo, - hsize_t idx) -{ - H5G_link_table_t ltable = {0, NULL}; /* Link table */ - H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity check */ - HDassert(oloc); - - /* Build table of all link messages */ - if(H5G__compact_build_table(oloc, linfo, H5_INDEX_NAME, H5_ITER_INC, <able) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5G_UNKNOWN, "can't create link message table") - - /* Check for going out of bounds */ - if(idx >= ltable.nlinks) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5G_UNKNOWN, "index out of bound") - - /* Determine type of object */ - if(ltable.lnks[idx].type == H5L_TYPE_SOFT) - ret_value = H5G_LINK; - else if(ltable.lnks[idx].type >= H5L_TYPE_UD_MIN) - ret_value = H5G_UDLINK; - else if(ltable.lnks[idx].type == H5L_TYPE_HARD){ - H5O_loc_t tmp_oloc; /* Temporary object location */ - H5O_type_t obj_type; /* Type of object at location */ - - /* Build temporary object location */ - tmp_oloc.file = oloc->file; - tmp_oloc.addr = ltable.lnks[idx].u.hard.addr; - - /* Get the type of the object */ - if(H5O_obj_type(&tmp_oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type") - - /* Map to group object type */ - if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(obj_type))) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type") - } else { - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "unknown link type") - } /* end else */ - -done: - /* Release link table */ - if(ltable.lnks && H5G__link_release_table(<able) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5G_UNKNOWN, "unable to release link table") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G__compact_get_type_by_idx() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - diff --git a/src/H5Gdense.c b/src/H5Gdense.c index d2bcad1..a2ef55c 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -1777,80 +1777,3 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__dense_delete() */ -#ifndef H5_NO_DEPRECATED_SYMBOLS - -/*------------------------------------------------------------------------- - * Function: H5G__dense_get_type_by_idx - * - * Purpose: Returns the type of objects in the group by giving index. - * - * Note: This routine assumes a lookup on the link name index in - * increasing order and isn't currently set up to be as - * flexible as other routines in this code module, because - * the H5Gget_objtype_by_idx that it's supporting is - * deprecated. - * - * Return: Success: Non-negative, object type - * Failure: Negative - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Sep 19 2006 - * - *------------------------------------------------------------------------- - */ -H5G_obj_t -H5G__dense_get_type_by_idx(H5F_t *f, H5O_linfo_t *linfo, hsize_t idx) -{ - H5G_link_table_t ltable = {0, NULL}; /* Table of links */ - H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* - * Check arguments. - */ - HDassert(f); - HDassert(linfo); - - /* Build the table of links for this group */ - if(H5G__dense_build_table(f, linfo, H5_INDEX_NAME, H5_ITER_INC, <able) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "error building table of links") - - /* Check for going out of bounds */ - if(idx >= ltable.nlinks) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "index out of bound") - - /* Determine type of object */ - if(ltable.lnks[idx].type == H5L_TYPE_SOFT) - ret_value = H5G_LINK; - else if(ltable.lnks[idx].type >= H5L_TYPE_UD_MIN) - ret_value = H5G_UDLINK; - else if(ltable.lnks[idx].type == H5L_TYPE_HARD) { - H5O_loc_t tmp_oloc; /* Temporary object location */ - H5O_type_t obj_type; /* Type of object at location */ - - /* Build temporary object location */ - tmp_oloc.file = f; - tmp_oloc.addr = ltable.lnks[idx].u.hard.addr; - - /* Get the type of the object */ - if(H5O_obj_type(&tmp_oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type") - - /* Map to group object type */ - if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(obj_type))) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type") - } else { - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "unknown link type") - } /* end else */ - -done: - /* Release link table */ - if(ltable.lnks && H5G__link_release_table(<able) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTFREE, H5G_UNKNOWN, "unable to release link table") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G__dense_get_type_by_idx() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index d2e991b..6ed5344 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -43,7 +43,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5Pprivate.h" /* Property lists */ -#include "H5VLprivate.h" /* VOL plugins */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -72,13 +72,9 @@ typedef struct { /********************/ /* Local Prototypes */ /********************/ - static herr_t H5G__get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5G__get_objinfo(const H5G_loc_t *loc, const char *name, - hbool_t follow_link, H5G_stat_t *statbuf/*out*/); -static H5G_obj_t H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx); #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -172,7 +168,7 @@ hid_t H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) { void *grp = NULL; /* New group created */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; H5P_genplist_t *plist; /* Property list pointer */ hid_t tmp_gcpl = H5I_INVALID_HID; /* Temporary group creation property list */ @@ -227,6 +223,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) if(H5P_set(plist, H5VL_PROP_GRP_LCPL_ID, &lcpl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get property value for lcpl id") + /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); @@ -235,13 +232,12 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the group */ - if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, tmp_gcpl, - H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_create(vol_obj, loc_params, name, tmp_gcpl, H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ - if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") + if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: if(H5I_INVALID_HID != tmp_gcpl && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT) @@ -249,7 +245,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release property list") if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -276,10 +272,10 @@ done: hid_t H5Gopen1(hid_t loc_id, const char *name) { - void *grp = NULL; /* Group opened */ - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + void *grp = NULL; /* Group opened */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "i*s", loc_id, name); @@ -297,17 +293,16 @@ H5Gopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the group */ - if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->driver->cls, name, H5P_DEFAULT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (grp = H5VL_group_open(vol_obj, loc_params, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") /* Get an atom for the group */ - if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") + if((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -348,9 +343,10 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new /* Create link */ if(type == H5L_TYPE_HARD) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; + H5VL_object_t tmp_vol_obj; /* Temporary object token of */ loc_params1.type = H5VL_OBJECT_BY_NAME; loc_params1.obj_type = H5I_get_type(cur_loc_id); @@ -371,13 +367,16 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target loc params") + /* Construct a temporary VOL object */ + tmp_vol_obj.data = NULL; + tmp_vol_obj.connector = vol_obj->connector; + /* Create the link through the VOL */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, NULL, loc_params2, vol_obj->driver->cls, - lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") - } + } /* end if */ else if(type == H5L_TYPE_SOFT) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; loc_params.type = H5VL_OBJECT_BY_NAME; @@ -394,10 +393,9 @@ 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, vol_obj->data, loc_params, vol_obj->driver->cls, - lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") - } + } /* end else-if */ else HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not a valid link type") @@ -441,8 +439,8 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, /* Create the appropriate kind of link */ if(type == H5L_TYPE_HARD) { - H5VL_object_t *vol_obj1 = NULL; /* object token of loc_id */ - H5VL_object_t *vol_obj2 = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj1; /* Object token of loc_id */ + H5VL_object_t *vol_obj2; /* Object token of loc_id */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; @@ -469,12 +467,11 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target name") /* Create the link through the VOL */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2->data, loc_params2, vol_obj2->driver->cls, - lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") - } + } /* end if */ else if(type == H5L_TYPE_SOFT) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; /* Soft links only need one location, the new_loc_id, but it's possible that @@ -496,10 +493,9 @@ 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, vol_obj->data, loc_params, vol_obj->driver->cls, - lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, loc_params, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") - } + } /* end else-if */ else HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid link type") @@ -518,10 +514,10 @@ done: herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*s*s", src_loc_id, src_name, dst_name); @@ -544,8 +540,7 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Move the link */ - if((ret_value = H5VL_link_move(vol_obj->data, loc_params1, NULL, loc_params2, vol_obj->driver->cls, - H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if(H5VL_link_move(vol_obj, loc_params1, NULL, loc_params2, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link") done: @@ -564,9 +559,9 @@ herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name) { - H5VL_object_t *vol_obj1 = NULL; /* object token of src_id */ + H5VL_object_t *vol_obj1 = NULL; /* Object token of src_id */ H5VL_loc_params_t loc_params1; - H5VL_object_t *vol_obj2 = NULL; /* object token of dst_id */ + H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */ H5VL_loc_params_t loc_params2; herr_t ret_value = SUCCEED; /* Return value */ @@ -582,27 +577,24 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, loc_params1.loc_data.loc_by_name.name = src_name; loc_params1.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; loc_params1.obj_type = H5I_get_type(src_loc_id); + /* Set location parameter for destination object */ loc_params2.type = H5VL_OBJECT_BY_NAME; loc_params2.loc_data.loc_by_name.name = dst_name; loc_params2.loc_data.loc_by_name.lapl_id = H5P_DEFAULT; loc_params2.obj_type = H5I_get_type(dst_loc_id); - if(H5L_SAME_LOC != src_loc_id) { + if(H5L_SAME_LOC != src_loc_id) /* get the location object */ if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - if(H5L_SAME_LOC != dst_loc_id) { + if(H5L_SAME_LOC != dst_loc_id) /* get the location object */ if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } /* Move the link */ - if((ret_value = H5VL_link_move(vol_obj1->data, loc_params1, vol_obj2->data, loc_params2, - vol_obj1->driver->cls, H5P_DEFAULT, H5P_DEFAULT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if(H5VL_link_move(vol_obj1, loc_params1, vol_obj2, loc_params2, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link") done: @@ -620,7 +612,7 @@ done: herr_t H5Gunlink(hid_t loc_id, const char *name) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -645,8 +637,7 @@ H5Gunlink(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Delete the link */ - if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_DELETE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") done: @@ -665,7 +656,7 @@ done: herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -690,8 +681,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the link value */ - if((ret_value = H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_VAL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size)) < 0) + if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link value") done: @@ -719,14 +709,13 @@ done: herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment) { - H5G_loc_t loc; /* Group's location */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*s*s", loc_id, name, comment); - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") @@ -734,8 +723,18 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment) if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set the comment */ - if(H5G_loc_set_comment(&loc, name, comment) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") done: @@ -769,14 +768,13 @@ done: int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) { - H5G_loc_t loc; /* Group's location */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; int ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("Is", "i*sz*s", loc_id, name, bufsize, buf); - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(bufsize > 0 && !buf) @@ -786,8 +784,18 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Get the comment */ - if((ret_value = (int)H5G_loc_get_comment(&loc, name, buf, bufsize)) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, loc_params, buf, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value") done: @@ -823,18 +831,17 @@ herr_t H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, void *op_data) { - H5G_loc_t loc; /* Location of object */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; H5G_link_iterate_t lnk_op; /* Link operator */ hsize_t last_obj; /* Index of last object looked at */ - hsize_t idx; /* Internal location to hold index */ + hsize_t idx; /* Internal location to hold index */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "i*s*Isx*x", loc_id, name, idx_p, op, op_data); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(idx_p && *idx_p < 0) @@ -850,9 +857,19 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, lnk_op.op_type = H5G_LINK_OP_OLD; lnk_op.op_func.op_old = op; - /* Call private function */ - if((ret_value = H5G_iterate(&loc, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") + /* Fill out location struct */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the object pointer */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") + + /* Call private iteration function, through VOL callback */ + if((ret_value = H5VL_group_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_GROUP_ITERATE_OLD, loc_params, idx, &last_obj, &lnk_op, op_data)) < 0) + HERROR(H5E_SYM, H5E_BADITER, "error iterating over group's links"); /* Set the index we stopped at */ if(idx_p) @@ -882,29 +899,35 @@ done: herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) { - H5G_loc_t loc; /* Location of object */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5I_type_t id_type; /* Type of ID */ + H5VL_loc_params_t loc_params; H5G_info_t grp_info; /* Group information */ - H5O_type_t obj_type; /* Type of object at location */ - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", loc_id, num_objs); /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") - if(H5O_obj_type(loc.oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get object type") - if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + id_type = H5I_get_type(loc_id); + if(!(H5I_GROUP == id_type || H5I_FILE == id_type)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group (or file) ID") if(!num_objs) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects") - /* Retrieve information about the group */ - if(H5G__obj_info(loc.oloc, &grp_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine # of objects") + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = id_type; + + /* Get group location */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Retrieve the group's information */ + if(H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, &grp_info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info") - /* Set the number of objects [sic: links] in the group */ + /* Set the number of objects [i.e. links] in the group */ *num_objs = grp_info.nlinks; done: @@ -931,23 +954,40 @@ done: */ herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, - H5G_stat_t *statbuf/*out*/) + H5G_stat_t *statbuf/*out*/) { - H5G_loc_t loc; /* Group's location */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*sbx", loc_id, name, follow_link, statbuf); /* Check arguments */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - /* Get info */ - if(H5G__get_objinfo(&loc, name, follow_link, statbuf) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + + /* Retrieve object info, if pointer to struct is given */ + if(statbuf) { + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + + /* Fill out location struct */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Retrieve the object's information */ + if(H5VL_group_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_GROUP_GET_OBJINFO, loc_params, (unsigned)follow_link, statbuf) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) + } /* end if */ done: FUNC_LEAVE_API(ret_value) @@ -972,6 +1012,7 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) { H5G_trav_goi_t *udata = (H5G_trav_goi_t *)_udata; /* User data passed in */ + H5G_stat_t *statbuf = udata->statbuf; /* Convenience pointer for statbuf */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -980,48 +1021,43 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c if(lnk == NULL && obj_loc == NULL) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "'%s' doesn't exist", name) - /* Only modify user's buffer if it's available */ - if(udata->statbuf) { - H5G_stat_t *statbuf = udata->statbuf; /* Convenience pointer for statbuf */ + /* Common code to retrieve the file's fileno */ + if(H5F_get_fileno((obj_loc ? obj_loc : grp_loc)->oloc->file, &statbuf->fileno[0]) < 0) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno") - /* Common code to retrieve the file's fileno */ - if(H5F_get_fileno((obj_loc ? obj_loc : grp_loc)->oloc->file, &statbuf->fileno[0]) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "unable to read fileno") + /* Info for soft and UD links is gotten by H5L_get_info. If we have + * a hard link, follow it and get info on the object + */ + if(udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) { + H5O_info_t oinfo; /* Object information */ - /* Info for soft and UD links is gotten by H5L_get_info. If we have - * a hard link, follow it and get info on the object - */ - if(udata->follow_link || !lnk || (lnk->type == H5L_TYPE_HARD)) { - H5O_info_t oinfo; /* Object information */ + /* Go retrieve the object information */ + /* (don't need index & heap info) */ + HDassert(obj_loc); + if(H5O_get_info(obj_loc->oloc, &oinfo, H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_HDR) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info") - /* Go retrieve the object information */ - /* (don't need index & heap info) */ - HDassert(obj_loc); - if(H5O_get_info(obj_loc->oloc, &oinfo, H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_HDR) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info") + /* Get mapped object type */ + statbuf->type = H5G_map_obj_type(oinfo.type); - /* Get mapped object type */ - statbuf->type = H5G_map_obj_type(oinfo.type); - - /* Get object number (i.e. address) for object */ - statbuf->objno[0] = (unsigned long)(oinfo.addr); + /* Get object number (i.e. address) for object */ + statbuf->objno[0] = (unsigned long)(oinfo.addr); #if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG - statbuf->objno[1] = (unsigned long)(oinfo.addr >> 8 * sizeof(long)); + statbuf->objno[1] = (unsigned long)(oinfo.addr >> 8 * sizeof(long)); #else - statbuf->objno[1] = 0; + statbuf->objno[1] = 0; #endif - /* Get # of hard links pointing to object */ - statbuf->nlink = oinfo.rc; + /* Get # of hard links pointing to object */ + statbuf->nlink = oinfo.rc; - /* Get modification time for object */ - statbuf->mtime = oinfo.ctime; + /* Get modification time for object */ + statbuf->mtime = oinfo.ctime; - /* Retrieve the object header information */ - statbuf->ohdr.size = oinfo.hdr.space.total; - statbuf->ohdr.free = oinfo.hdr.space.free; - statbuf->ohdr.nmesgs = oinfo.hdr.nmesgs; - statbuf->ohdr.nchunks = oinfo.hdr.nchunks; - } /* end if */ + /* Retrieve the object header information */ + statbuf->ohdr.size = oinfo.hdr.space.total; + statbuf->ohdr.free = oinfo.hdr.space.free; + statbuf->ohdr.nmesgs = oinfo.hdr.nmesgs; + statbuf->ohdr.nchunks = oinfo.hdr.nchunks; } /* end if */ done: @@ -1049,22 +1085,22 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, H5G_stat_t *statbuf/*out*/) { H5G_trav_goi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(loc); HDassert(name && *name); + HDassert(statbuf); - /* Reset stat buffer, if one was given */ - if(statbuf) - HDmemset(statbuf, 0, sizeof(H5G_stat_t)); + /* Reset stat buffer */ + HDmemset(statbuf, 0, sizeof(H5G_stat_t)); /* Set up user data for retrieving information */ udata.statbuf = statbuf; @@ -1072,12 +1108,11 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, udata.loc_file = loc->oloc->file; /* Traverse the group hierarchy to locate the object to get info about */ - if(H5G_traverse(loc, name, (unsigned)(follow_link ? H5G_TARGET_NORMAL : H5G_TARGET_SLINK|H5G_TARGET_UDLINK), - H5G__get_objinfo_cb, &udata) < 0) + if(H5G_traverse(loc, name, (unsigned)(follow_link ? H5G_TARGET_NORMAL : (H5G_TARGET_SLINK | H5G_TARGET_UDLINK)), H5G__get_objinfo_cb, &udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist") /* If we're pointing at a soft or UD link, get the real link length and type */ - if(statbuf && follow_link == 0) { + if(follow_link == 0) { H5L_info_t linfo; /* Link information buffer */ herr_t ret; @@ -1129,24 +1164,33 @@ done: ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) { - H5G_loc_t loc; /* Object location */ - H5O_type_t obj_type; /* Type of object at location */ - ssize_t ret_value; + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("Zs", "ih*sz", loc_id, idx, name, size); - /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") - if(H5O_obj_type(loc.oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get object type") - if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + /* Set up collective metadata if appropriate */ + if(H5CX_set_loc(loc_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set collective metadata read info") + + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = "."; + loc_params.loc_data.loc_by_idx.idx_type = H5_INDEX_NAME; + loc_params.loc_data.loc_by_idx.order = H5_ITER_INC; + loc_params.loc_data.loc_by_idx.n = idx; + loc_params.loc_data.loc_by_idx.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Call internal function */ - if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object name") + if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get object name") done: FUNC_LEAVE_API(ret_value) @@ -1171,82 +1215,39 @@ done: H5G_obj_t H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) { - H5G_loc_t loc; /* Object location */ - H5G_obj_t ret_value; + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; + H5O_info_t oinfo; /* Object info (contains object type) */ + unsigned fields; /* Which fields in object info to populate */ + H5G_obj_t ret_value; /* Return value */ FUNC_ENTER_API(H5G_UNKNOWN) H5TRACE2("Go", "ih", loc_id, idx); - /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location ID") - - /* Call internal function*/ - if(H5G_UNKNOWN == (ret_value = H5G__obj_get_type_by_idx(loc.oloc, idx))) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object type") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Gget_objtype_by_idx() */ - - -/*------------------------------------------------------------------------- - * Function: H5G__obj_get_type_by_idx - * - * Purpose: Private function for H5Gget_objtype_by_idx. - * Returns the type of objects in the group by giving index. - * - * Return: Success: H5G_GROUP(1), H5G_DATASET(2), H5G_TYPE(3) - * - * Failure: Negative - * - * Programmer: Raymond Lu - * Nov 20, 2002 - * - *------------------------------------------------------------------------- - */ -static H5G_obj_t -H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx) -{ - H5O_linfo_t linfo; /* Link info message */ - htri_t linfo_exists; /* Whether the link info message exists */ - H5O_type_t obj_type; /* Type of object at location */ - H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_IDX; + loc_params.loc_data.loc_by_idx.name = "."; + loc_params.loc_data.loc_by_idx.idx_type = H5_INDEX_NAME; + loc_params.loc_data.loc_by_idx.order = H5_ITER_INC; + loc_params.loc_data.loc_by_idx.n = idx; + loc_params.loc_data.loc_by_idx.lapl_id = H5P_LINK_ACCESS_DEFAULT; + loc_params.obj_type = H5I_get_type(loc_id); - FUNC_ENTER_STATIC_TAG(oloc->addr) + /* Get the location object */ + if(NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier") - /* Sanity check */ - HDassert(oloc); + /* Retrieve the object's basic information (which includes its type) */ + fields = H5O_INFO_BASIC; + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, &oinfo, fields) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object info") - /* Check args */ - if(H5O_obj_type(oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type") - if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "not a group") - - /* Attempt to get the link info for this group */ - if((linfo_exists = H5G__obj_get_linfo(oloc, &linfo)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't check for link info message") - if(linfo_exists) { - if(H5F_addr_defined(linfo.fheap_addr)) { - /* Get the object's name from the dense link storage */ - if((ret_value = H5G__dense_get_type_by_idx(oloc->file, &linfo, idx)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type") - } /* end if */ - else { - /* Get the object's type from the link messages */ - if((ret_value = H5G__compact_get_type_by_idx(oloc, &linfo, idx)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type") - } /* end else */ - } /* end if */ - else { - /* Get the object's type from the symbol table */ - if((ret_value = H5G__stab_get_type_by_idx(oloc, idx)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "can't locate type") - } /* end else */ + /* Map to group object type */ + if(H5G_UNKNOWN == (ret_value = H5G_map_obj_type(oinfo.type))) + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type") done: - FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5G__obj_get_type_by_idx() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Gget_objtype_by_idx() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Gint.c b/src/H5Gint.c index 26c582e..049c696 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -39,7 +39,6 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ -#include "H5VLnative_private.h" /* Native VOL driver */ /****************/ @@ -579,7 +578,7 @@ H5G_oloc(H5G_t *grp) *------------------------------------------------------------------------- */ H5G_name_t * -H5G_nameof(H5G_t *grp) +H5G_nameof(const H5G_t *grp) { /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -808,7 +807,7 @@ H5G_iterate(H5G_loc_t *loc, const char *group_name, */ if(NULL == (grp = H5G__open_name(loc, group_name))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((gid = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0) + if((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") /* Set up user data for callback */ @@ -1070,7 +1069,7 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") /* Register an ID for the starting group */ - if((gid = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0) + if((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") /* Get the location of the starting group */ diff --git a/src/H5Gname.c b/src/H5Gname.c index b6b0c20..f6ddeeb 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -584,21 +584,9 @@ H5G_get_name(const H5G_loc_t *loc, char *name/*out*/, size_t size, *cached = TRUE; } /* end if */ else if(!loc->path->obj_hidden) { - hid_t file; - - /* Retrieve file ID for name search */ - if((file = H5F_get_id(loc->oloc->file, FALSE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get file ID") - /* Search for name of object */ - if((len = H5G_get_name_by_addr(file, loc->oloc, name, size)) < 0) { - H5I_dec_ref(file); + if((len = H5G_get_name_by_addr(loc->oloc->file, loc->oloc, name, size)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't determine name") - } /* end if */ - - /* Close file ID used for search */ - if(H5I_dec_ref(file) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCLOSEFILE, FAIL, "can't determine name") /* Indicate that the name is _not_ cached, if requested */ /* (Currently only used for testing - QAK, 2010/07/26) */ @@ -1282,8 +1270,7 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc, - char *name, size_t size) +H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size) { H5G_gnba_iter_t udata; /* User data for iteration */ H5G_loc_t root_loc; /* Root group's location */ @@ -1296,8 +1283,8 @@ H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc, FUNC_ENTER_NOAPI((-1)) - /* Construct the link info for the file's root group */ - if(H5G_loc(file, &root_loc) < 0) + /* Construct a group location for root group of the file */ + if(H5G_root_loc(f, &root_loc) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get root group's location") /* Check for root group being the object looked for */ diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 836213d..ef330c4 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -299,6 +299,14 @@ typedef struct H5G_copy_file_ud_t { H5G_cache_t cache; /* Cached data for symbol table entry */ } H5G_copy_file_ud_t; +/* Types for optional group VOL operations */ +typedef enum H5VL_group_optional_t { +#ifndef H5_NO_DEPRECATED_SYMBOLS + H5VL_GROUP_ITERATE_OLD, /* HG5Giterate (deprecated routine) */ + H5VL_GROUP_GET_OBJINFO /* HG5Gget_objinfo (deprecated routine) */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ +} H5VL_group_optional_t; + /*****************************/ /* Package Private Variables */ @@ -381,9 +389,6 @@ H5_DLL herr_t H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t #ifndef H5_STRICT_FORMAT_CHECKS H5_DLL herr_t H5G__stab_valid(H5O_loc_t *grp_oloc, H5O_stab_t *alt_stab); #endif /* H5_STRICT_FORMAT_CHECKS */ -#ifndef H5_NO_DEPRECATED_SYMBOLS -H5_DLL H5G_obj_t H5G__stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* @@ -448,10 +453,6 @@ H5_DLL htri_t H5G__compact_lookup(const H5O_loc_t *grp_oloc, const char *name, H5_DLL herr_t H5G__compact_lookup_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_link_t *lnk); -#ifndef H5_NO_DEPRECATED_SYMBOLS -H5_DLL H5G_obj_t H5G__compact_get_type_by_idx(H5O_loc_t *oloc, - const H5O_linfo_t *linfo, hsize_t idx); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Functions that understand "dense" link storage */ H5_DLL herr_t H5G__dense_build_table(H5F_t *f, const H5O_linfo_t *linfo, @@ -476,10 +477,6 @@ H5_DLL herr_t H5G__dense_remove_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_r, H5_index_t idx_type, H5_iter_order_t order, hsize_t n); H5_DLL herr_t H5G__dense_delete(H5F_t *f, H5O_linfo_t *linfo, hbool_t adj_link); -#ifndef H5_NO_DEPRECATED_SYMBOLS -H5_DLL H5G_obj_t H5G__dense_get_type_by_idx(H5F_t *f, H5O_linfo_t *linfo, - hsize_t idx); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Functions that understand group objects */ H5_DLL herr_t H5G__obj_create(H5F_t *f, H5G_obj_create_t *gcrt_info, @@ -494,6 +491,10 @@ H5_DLL herr_t H5G__obj_iterate(const H5O_loc_t *grp_oloc, H5_DLL herr_t H5G__obj_info(const H5O_loc_t *oloc, H5G_info_t *grp_info); H5_DLL htri_t H5G__obj_lookup(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk); +#ifndef H5_NO_DEPRECATED_SYMBOLS +H5_DLL herr_t H5G__get_objinfo(const H5G_loc_t *loc, const char *name, + hbool_t follow_link, H5G_stat_t *statbuf/*out*/); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* * These functions operate on group hierarchy names. diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index f4f04bc..f149f29 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -187,7 +187,7 @@ typedef struct H5G_entry_t H5G_entry_t; * call. */ H5_DLL struct H5O_loc_t *H5G_oloc(H5G_t *grp); -H5_DLL H5G_name_t * H5G_nameof(H5G_t *grp); +H5_DLL H5G_name_t * H5G_nameof(const H5G_t *grp); H5_DLL H5F_t *H5G_fileof(H5G_t *grp); H5_DLL H5G_t *H5G_open(const H5G_loc_t *loc); H5_DLL herr_t H5G_close(H5G_t *grp); @@ -261,7 +261,7 @@ H5_DLL herr_t H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_dept H5_DLL herr_t H5G_name_free(H5G_name_t *name); H5_DLL ssize_t H5G_get_name(const H5G_loc_t *loc, char *name/*out*/, size_t size, hbool_t *cached); -H5_DLL ssize_t H5G_get_name_by_addr(hid_t fid, const struct H5O_loc_t *loc, +H5_DLL ssize_t H5G_get_name_by_addr(H5F_t *f, const struct H5O_loc_t *loc, char* name, size_t size); H5_DLL H5RS_str_t *H5G_build_fullpath_refstr_str(H5RS_str_t *path_r, const char *name); diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 9072b97..e8d38b9 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -1103,118 +1103,3 @@ done: } /* end H5G__stab_valid */ #endif /* H5_STRICT_FORMAT_CHECKS */ -#ifndef H5_NO_DEPRECATED_SYMBOLS - -/*------------------------------------------------------------------------- - * Function: H5G_stab_get_type_by_idx_cb - * - * Purpose: Callback for B-tree iteration 'by index' info query to - * retrieve the type of an object - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * Nov 7, 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G_stab_get_type_by_idx_cb(const H5G_entry_t *ent, void *_udata) -{ - H5G_bt_it_gtbi_t *udata = (H5G_bt_it_gtbi_t *)_udata; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Sanity check */ - HDassert(ent); - HDassert(udata); - - /* Check for a soft link */ - switch(ent->type) { - case H5G_CACHED_SLINK: - udata->type = H5G_LINK; - break; - - case H5G_CACHED_ERROR: - case H5G_NOTHING_CACHED: - case H5G_CACHED_STAB: - case H5G_NCACHED: - default: - { - H5O_loc_t tmp_oloc; /* Temporary object location */ - H5O_type_t obj_type; /* Type of object at location */ - - /* Build temporary object location */ - tmp_oloc.file = udata->f; - HDassert(H5F_addr_defined(ent->header)); - tmp_oloc.addr = ent->header; - - /* Get the type of the object */ - if(H5O_obj_type(&tmp_oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") - udata->type = H5G_map_obj_type(obj_type); - } - break; - } /* end switch */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_stab_get_type_by_idx_cb */ - - -/*------------------------------------------------------------------------- - * Function: H5G__stab_get_type_by_idx - * - * Purpose: Private function for H5Gget_objtype_by_idx. - * Returns the type of objects in the group by giving index. - * - * Return: Success: H5G_GROUP(1), H5G_DATASET(2), H5G_TYPE(3) - * - * Failure: UNKNOWN - * - * Programmer: Raymond Lu - * Nov 20, 2002 - * - *------------------------------------------------------------------------- - */ -H5G_obj_t -H5G__stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx) -{ - H5O_stab_t stab; /* Info about local heap & B-tree */ - H5G_bt_it_gtbi_t udata; /* User data for B-tree callback */ - H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ - - FUNC_ENTER_PACKAGE_TAG(oloc->addr) - - /* Sanity check */ - HDassert(oloc); - - /* Get the B-tree & local heap info */ - if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "unable to determine local heap address") - - /* Set iteration information */ - udata.common.idx = idx; - udata.common.num_objs = 0; - udata.common.op = H5G_stab_get_type_by_idx_cb; - udata.f = oloc->file; - udata.type = H5G_UNKNOWN; - - /* Iterate over the group members */ - if(H5B_iterate(oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "iteration operator failed") - - /* If we don't know the type now, we almost certainly went out of bounds */ - if(udata.type == H5G_UNKNOWN) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "index out of bound") - - /* Set the return value */ - ret_value = udata.type; - -done: - FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5G__stab_get_type_by_idx() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 8fefcd8..2d8de99 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -198,7 +198,7 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, /* Create a group ID to pass to the user-defined callback */ if(NULL == (grp = H5G_open(&grp_loc_copy))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((cur_grp = H5VL_native_register(H5I_GROUP, grp, FALSE)) < 0) + if((cur_grp = H5VL_wrap_register(H5I_GROUP, grp, FALSE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group") /* User-defined callback function */ @@ -33,8 +33,9 @@ #include "H5ACprivate.h" /* Metadata cache */ #include "H5CXprivate.h" /* API Contexts */ #include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5Gprivate.h" /* Groups */ #include "H5Ipkg.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ @@ -130,6 +131,7 @@ H5FL_DEFINE_STATIC(H5I_class_t); H5FL_EXTERN(H5VL_object_t); /*--------------------- Local function prototypes ---------------------------*/ +static void *H5I__unwrap(void *obj_ptr, H5I_type_t type); static htri_t H5I__clear_type_cb(void *_id, void *key, void *udata); static int H5I__destroy_type(H5I_type_t type); static void *H5I__remove_verify(hid_t id, H5I_type_t id_type); @@ -139,7 +141,6 @@ static int H5I__get_type_ref(H5I_type_t type); static int H5I__search_cb(void *obj, hid_t id, void *_udata); static H5I_id_info_t *H5I__find_id(hid_t id); static int H5I__iterate_pub_cb(void *obj, hid_t id, void *udata); -static hid_t H5I__get_file_id(hid_t obj_id, H5I_type_t id_type); static int H5I__find_id_cb(void *_item, void *_key, void *_udata); static int H5I__id_dump_cb(void *_item, void *_key, void *_udata); @@ -452,6 +453,50 @@ done: /*------------------------------------------------------------------------- + * Function: H5I__unwrap + * + * Purpose: Unwraps the object pointer for the 'item' that corresponds + * to an ID. + * + * Return: Pointer to the unwrapped pointer (can't fail) + * + * Programmer: Quincey Koziol + * Friday, October 19, 2018 + * + *------------------------------------------------------------------------- + */ +static void * +H5I__unwrap(void *obj_ptr, H5I_type_t type) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(obj_ptr); + + /* The stored object pointer might be an H5VL_object_t, in which + * case we'll need to get the wrapped object struct (H5F_t *, etc.). + */ + if(H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { + const H5VL_object_t *vol_obj; + + vol_obj = (const H5VL_object_t *)obj_ptr; + ret_value = H5VL_object_data(vol_obj); + } /* end if */ + else if(H5I_DATATYPE == type) { + H5T_t *dt = (H5T_t *)obj_ptr; + + ret_value = (void *)H5T_get_actual_type(dt); + } /* end if */ + else + ret_value = obj_ptr; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__unwrap() */ + + +/*------------------------------------------------------------------------- * Function: H5Iclear_type * * Purpose: Removes all objects from the type, calling the free @@ -547,6 +592,7 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) FUNC_ENTER_STATIC_NOERR + /* Sanity checks */ HDassert(id); HDassert(udata); HDassert(udata->type_ptr); @@ -556,8 +602,7 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) */ if(udata->force || (id->count - (!udata->app_ref * id->app_count)) <= 1) { /* Check for a 'free' function and call it, if it exists */ - /* (Casting away const OK -QAK) */ - if(udata->type_ptr->cls->free_func && (udata->type_ptr->cls->free_func)((void *)id->obj_ptr) < 0) { + if(udata->type_ptr->cls->free_func && (udata->type_ptr->cls->free_func)((void *)id->obj_ptr) < 0) { /* (Casting away const OK -QAK) */ if(udata->force) { #ifdef H5I_DEBUG if(H5DEBUG(I)) { @@ -858,8 +903,7 @@ H5I_subst(hid_t id, const void *new_object) HGOTO_ERROR(H5E_ATOM, H5E_NOTFOUND, NULL, "can't get ID ref count") /* Get the old object pointer to return */ - /* (Casting away const OK -QAK) */ - ret_value = (void *)id_ptr->obj_ptr; + ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ /* Set the new object pointer for the ID */ id_ptr->obj_ptr = new_object; @@ -1980,16 +2024,7 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) /* The stored object pointer might be an H5VL_object_t, in which * case we'll need to get the wrapped object struct (H5F_t *, etc.). */ - if(H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { - const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; - obj_ptr = vol_obj->data; - } - else if(H5I_DATATYPE == type) { - const H5T_t *dt = (const H5T_t *)item->obj_ptr; - obj_ptr = (void *)H5T_get_actual_type(dt); - } - else - obj_ptr = item->obj_ptr; + obj_ptr = H5I__unwrap((void *)item->obj_ptr, type); /* Invoke callback function */ cb_ret_val = (*udata->user_func)((void *)obj_ptr, item->id, udata->user_udata); /* (Casting away const OK) */ @@ -1999,7 +2034,7 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) ret_value = H5_ITER_STOP; /* terminate iteration early */ else if(cb_ret_val < 0) ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ - } + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__iterate_cb() */ @@ -2057,7 +2092,7 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re /* Iterate over IDs */ if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed") - } + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -2111,7 +2146,7 @@ done: * * Failure: -1 * - * NOTE: Not safe for arbitrary VOL drivers as it relies on + * NOTE: Not safe for arbitrary VOL connectors as it relies on * private H5G calls. * * Comments: Public function @@ -2129,18 +2164,24 @@ done: ssize_t H5Iget_name(hid_t id, char *name/*out*/, size_t size) { + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; H5G_loc_t loc; /* Object location */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE3("Zs", "ixz", id, name, size); - /* Get object location */ - if(H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") + /* Get the object pointer */ + if(NULL == (vol_obj = H5VL_vol_object(id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(id); /* Retrieve object's name */ - if((ret_value = H5G_get_name(&loc, name, size, NULL)) < 0) + if(H5VL_object_get(vol_obj, loc_params, H5VL_ID_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: @@ -2174,9 +2215,9 @@ H5Iget_file_id(hid_t obj_id) /* Call internal function */ if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { - if ((ret_value = H5I__get_file_id(obj_id, type)) < 0) + if ((ret_value = H5F_get_file_id(obj_id, type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID") - } + } /* end if */ else HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "not an ID of a file object") @@ -2186,56 +2227,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5I__get_file_id - * - * Purpose: The private version of H5Iget_file_id(), obtains the file - * ID given an object ID. - * - * Return: Success: The file ID associated with the object - * Failure: H5I_INVALID_HID - * - *------------------------------------------------------------------------- - */ -static hid_t -H5I__get_file_id(hid_t obj_id, H5I_type_t type) -{ - H5VL_object_t *vol_obj = NULL; - void *file = NULL; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ - - FUNC_ENTER_STATIC - - /* Get the object pointer */ - if (NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier") - - /* Get the file through the VOL */ - if (H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_OBJECT_GET_FILE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, &file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file") - if (NULL == file) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file through the VOL") - - /* Check if the file's ID already exists */ - if (H5I_find_id(file, H5I_FILE, &ret_value) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed") - - /* If the ID does not exist, register it with the VOL driver */ - if (H5I_INVALID_HID == ret_value) { - if ((ret_value = H5VL_register(H5I_FILE, file, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") - } - else { - /* Increment ref count on existing ID */ - if (H5I_inc_ref(ret_value, TRUE) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") - } - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I__get_file_id() */ - - -/*------------------------------------------------------------------------- * Function: H5I__find_id_cb * * Purpose: Callback for searching for an ID with a specific pointer @@ -2260,23 +2251,14 @@ H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) HDassert(item); HDassert(udata); - /* Get a pointer to the VOL driver's data */ - if (H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { - const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; - obj_ptr = vol_obj->data; - } - else if (H5I_DATATYPE == type) { - const H5T_t *dt = (const H5T_t *)item->obj_ptr; - obj_ptr = (void *)H5T_get_actual_type(dt); - } - else - obj_ptr = item->obj_ptr; + /* Get a pointer to the VOL connector's data */ + obj_ptr = H5I__unwrap(item->obj_ptr, type); /* Check for a match */ if (obj_ptr == udata->object) { udata->ret_id = item->id; ret_value = H5_ITER_STOP; - } + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__find_id_cb() */ @@ -2324,7 +2306,7 @@ H5I_find_id(const void *object, H5I_type_t type, hid_t *id) HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed") *id = udata.ret_id; - } + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -2346,7 +2328,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ H5I_type_t type = *(H5I_type_t *)_udata; /* User data */ H5G_name_t *path = NULL; /* Path to file object */ - const void *obj_ptr = NULL; /* Pointer to VOL driver object */ + const void *obj_ptr = NULL; /* Pointer to VOL connector object */ FUNC_ENTER_STATIC_NOERR @@ -2360,31 +2342,31 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) { const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; - obj_ptr = vol_obj->data; - - if(H5_VOL_NATIVE == vol_obj->driver->cls->value) - path = H5G_nameof((H5G_t *)obj_ptr); + obj_ptr = H5VL_object_data(vol_obj); + if(H5_VOL_NATIVE == vol_obj->connector->cls->value) + path = H5G_nameof((const H5G_t *)obj_ptr); break; } + case H5I_DATASET: { const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; - obj_ptr = vol_obj->data; - - if(H5_VOL_NATIVE == vol_obj->driver->cls->value) - path = H5D_nameof((H5D_t *)obj_ptr); + obj_ptr = H5VL_object_data(vol_obj); + if(H5_VOL_NATIVE == vol_obj->connector->cls->value) + path = H5D_nameof((const H5D_t *)obj_ptr); break; } + case H5I_DATATYPE: { const H5T_t *dt = (const H5T_t *)item->obj_ptr; - obj_ptr = (void *)H5T_get_actual_type(dt); - - path = H5T_nameof((H5T_t *)obj_ptr); + obj_ptr = (void *)H5T_get_actual_type((H5T_t *)dt); /* Casting away const OK - QAK */ + path = H5T_nameof((const H5T_t *)obj_ptr); break; } + case H5I_UNINIT: case H5I_BADID: case H5I_FILE: diff --git a/src/H5Itest.c b/src/H5Itest.c index 4b54835..79bc482 100644 --- a/src/H5Itest.c +++ b/src/H5Itest.c @@ -78,26 +78,41 @@ ssize_t H5I__get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached) { + H5VL_object_t *vol_obj; /* Object token of id */ H5G_loc_t loc; /* Object location */ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + hbool_t vol_wrapper_set = FALSE;/* Whether the VOL object wrapping context was set up */ ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_PACKAGE - /* Get object location */ - if(H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") - /* Set API context */ if(H5CX_push() < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set API context") api_ctx_pushed = TRUE; + /* Get the object pointer */ + if(NULL == (vol_obj = H5VL_vol_object(id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Get object location */ + if(H5G_loc(id, &loc) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") + /* Call internal group routine to retrieve object's name */ if((ret_value = H5G_get_name(&loc, name, size, cached)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_ATOM, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + if(api_ctx_pushed && H5CX_pop() < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRESET, (-1), "can't reset API context") @@ -34,7 +34,7 @@ #include "H5Oprivate.h" /* File objects */ #include "H5Pprivate.h" /* Property lists */ #include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VLnative_private.h" /* Native VOL driver */ +#include "H5VLnative_private.h" /* Native VOL connector */ /****************/ @@ -316,28 +316,22 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, loc_params2.loc_data.loc_by_name.lapl_id = lapl_id; loc_params2.obj_type = H5I_get_type(dst_loc_id); - if (H5L_SAME_LOC != src_loc_id) { + if (H5L_SAME_LOC != src_loc_id) /* Get the location object */ if (NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - if (H5L_SAME_LOC != dst_loc_id) { + if (H5L_SAME_LOC != dst_loc_id) /* Get the location object */ if (NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - /* Make sure that the VOL drivers are the same */ - if (vol_obj1 && vol_obj2) { - if (vol_obj1->driver->cls->value != vol_obj2->driver->cls->value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") - } + /* Make sure that the VOL connectors are the same */ + if (vol_obj1 && vol_obj2) + if (vol_obj1->connector->cls->value != vol_obj2->connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked") /* Move the link */ - if (H5VL_link_move((vol_obj1 ? vol_obj1->data : NULL), loc_params1, - (vol_obj2 ? vol_obj2->data : NULL), loc_params2, - (vol_obj1 ? vol_obj1->driver->cls : vol_obj2->driver->cls), - lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_move(vol_obj1, loc_params1, vol_obj2, loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: @@ -367,6 +361,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, H5VL_loc_params_t loc_params1; H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */ H5VL_loc_params_t loc_params2; + H5VL_object_t tmp_vol_obj; /* Temporary object token of */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -392,7 +387,6 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, if(H5P_DEFAULT == lcpl_id) lcpl_id = H5P_LINK_CREATE_DEFAULT; - /* Set location paramter for source object */ loc_params1.type = H5VL_OBJECT_BY_NAME; loc_params1.loc_data.loc_by_name.name = src_name; @@ -405,28 +399,26 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, loc_params2.loc_data.loc_by_name.lapl_id = lapl_id; loc_params2.obj_type = H5I_get_type(dst_loc_id); - if(H5L_SAME_LOC != src_loc_id) { + if(H5L_SAME_LOC != src_loc_id) /* Get the location object */ if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - if(H5L_SAME_LOC != dst_loc_id) { + if(H5L_SAME_LOC != dst_loc_id) /* Get the location object */ if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - /* Make sure that the VOL plugins are the same */ - if(vol_obj1 && vol_obj2) { - if(vol_obj1->driver->cls->value != vol_obj2->driver->cls->value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") - } + /* Make sure that the VOL connectors are the same */ + if(vol_obj1 && vol_obj2) + if(vol_obj1->connector->cls->value != vol_obj2->connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked") + + /* Construct a temporary source VOL object */ + tmp_vol_obj.data = (vol_obj1 ? vol_obj1->data : NULL); + tmp_vol_obj.connector = (vol_obj1 ? vol_obj1->connector : vol_obj2->connector); /* Copy the link */ - if(H5VL_link_copy((vol_obj1 ? vol_obj1->data : NULL), loc_params1, - (vol_obj2 ? vol_obj2->data : NULL), loc_params2, - (vol_obj1 ? vol_obj1->driver->cls : vol_obj2->driver->cls), - lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_copy(&tmp_vol_obj, loc_params1, vol_obj2, loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to copy link") done: @@ -505,8 +497,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Create the link */ - if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->driver->cls, - lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link") done: @@ -534,8 +525,9 @@ herr_t H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id) { - H5VL_object_t *vol_obj1 = NULL; /* object token of cur_loc_id */ - H5VL_object_t *vol_obj2 = NULL; /* object token of new_loc_id */ + H5VL_object_t *vol_obj1 = NULL; /* Object token of cur_loc_id */ + H5VL_object_t *vol_obj2 = NULL; /* Object token of new_loc_id */ + H5VL_object_t tmp_vol_obj; /* Temporary object token of */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; H5P_genplist_t *plist; /* Property list pointer */ @@ -578,22 +570,19 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, loc_params2.loc_data.loc_by_name.name = new_name; loc_params2.loc_data.loc_by_name.lapl_id = lapl_id; - if(H5L_SAME_LOC != cur_loc_id) { + if(H5L_SAME_LOC != cur_loc_id) /* Get the current location object */ if (NULL == (vol_obj1 = (H5VL_object_t *)H5VL_vol_object(cur_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - if(H5L_SAME_LOC != new_loc_id) { + if(H5L_SAME_LOC != new_loc_id) /* Get the new location object */ if(NULL == (vol_obj2 = (H5VL_object_t *)H5VL_vol_object(new_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - /* Make sure that the VOL drivers are the same */ - if(vol_obj1 && vol_obj2) { - if(vol_obj1->driver->cls->value != vol_obj2->driver->cls->value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL drivers and can't be linked") - } + /* Make sure that the VOL connectors are the same */ + if(vol_obj1 && vol_obj2) + if(vol_obj1->connector->cls->value != vol_obj2->connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked") /* Get the link creation plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) @@ -605,10 +594,12 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't set property value for target name") + /* Construct a temporary VOL object */ + tmp_vol_obj.data = (vol_obj2 ? (vol_obj2->data) : NULL); + tmp_vol_obj.connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector); + /* Create the link */ - if(H5VL_link_create(H5VL_LINK_CREATE_HARD, (vol_obj2 ? (vol_obj2->data) : NULL), loc_params2, - (vol_obj1 != NULL ? vol_obj1->driver->cls : vol_obj2->driver->cls), - lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create hard link") done: @@ -644,10 +635,10 @@ herr_t H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE7("e", "i*sLl*xzii", link_loc_id, link_name, link_type, udata, @@ -689,8 +680,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 external link */ - if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj->data, loc_params, vol_obj->driver->cls, - lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -744,8 +734,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Unlink */ - if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_DELETE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: @@ -808,8 +797,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Delete the link */ - if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_DELETE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: @@ -865,8 +853,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the link value */ - if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_VAL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) + if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) done: @@ -930,8 +917,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, "invalid location identifier") /* Get the link value */ - if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_VAL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) + if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value") done: @@ -982,8 +968,7 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check for the existence of the link */ - if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_EXISTS, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: @@ -1034,8 +1019,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the link information */ - if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_INFO, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) + if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: @@ -1095,8 +1079,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the link information */ - if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_INFO, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) + if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: @@ -1292,8 +1275,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Get the link information */ - if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_NAME, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0) + if(H5VL_link_get(vol_obj, loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, (-1), "unable to get link name") done: @@ -1351,9 +1333,7 @@ H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, loc_params.obj_type = H5I_get_type(group_id); /* Iterate over the links */ - if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_ITER, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - FALSE, idx_type, order, idx_p, op, op_data)) < 0) + if((ret_value = H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: @@ -1423,8 +1403,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; /* Iterate over the links */ - if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_ITER, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) + if((ret_value = H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: @@ -1492,9 +1471,7 @@ H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Iterate over the links */ - if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_ITER, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - TRUE, idx_type, order, NULL, op, op_data)) < 0) + if((ret_value = H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: @@ -1569,9 +1546,7 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; /* Visit the links */ - if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_ITER, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - TRUE, idx_type, order, NULL, op, op_data)) < 0) + if((ret_value = H5VL_link_specific(vol_obj, loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: @@ -1949,7 +1924,7 @@ H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t H5_ATT /* Set up location for user-defined callback */ if(NULL == (grp = H5G_open(&temp_loc))) HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((grp_id = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0) + if((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register ID for group") /* Make callback */ @@ -2734,7 +2709,7 @@ H5L__move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, /* Set up location for user-defined callback */ if(NULL == (grp = H5G_open(&temp_loc))) HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((grp_id = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0) + if((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register group ID") if(udata->copy) { diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 34c96a8..ad0344e 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -34,7 +34,7 @@ #include "H5Opublic.h" /* File objects */ #include "H5Pprivate.h" /* Property lists */ #include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VLnative_private.h" /* Native VOL driver */ +#include "H5VLnative_private.h" /* Native VOL connector */ /****************/ @@ -243,7 +243,7 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") /* Get an ID for the external link's object */ - if((ext_obj_id = H5VL_native_register(opened_type, ext_obj, TRUE)) < 0) + if((ext_obj_id = H5VL_wrap_register(opened_type, ext_obj, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register external link object") /* Set return value */ @@ -414,8 +414,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 an external link */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj->data, loc_params, vol_obj->driver->cls, - lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create external link") done: @@ -100,7 +100,7 @@ hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5I_type_t opened_type; void *opened_obj = NULL; H5VL_loc_params_t loc_params; @@ -130,13 +130,13 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) loc_params.obj_type = H5I_get_type(loc_id); /* Open the object */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, - &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (opened_obj = H5VL_object_open(vol_obj, loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") /* Get an atom for the object */ - if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") + if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") + done: FUNC_LEAVE_API(ret_value) } /* end H5Oopen() */ @@ -169,7 +169,7 @@ hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5I_type_t opened_type; void *opened_obj = NULL; H5VL_loc_params_t loc_params; @@ -203,12 +203,11 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the object */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, - &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (opened_obj = H5VL_object_open(vol_obj, loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") - if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") + if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: FUNC_LEAVE_API(ret_value) @@ -253,7 +252,7 @@ done: hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5I_type_t opened_type; void *opened_obj = NULL; H5VL_loc_params_t loc_params; @@ -271,13 +270,12 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the object */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, &opened_type, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (opened_obj = H5VL_object_open(vol_obj, loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") /* Register the dataset ID */ - if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") + if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: FUNC_LEAVE_API(ret_value) @@ -311,6 +309,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, { H5VL_object_t *vol_obj1 = NULL; /* object token of obj_id */ H5VL_object_t *vol_obj2 = NULL; /* object token of new_loc_id */ + H5VL_object_t tmp_vol_obj; /* Temporary object token of */ H5VL_loc_params_t loc_params1; H5VL_loc_params_t loc_params2; H5P_genplist_t *plist; /* Property list pointer */ @@ -348,21 +347,19 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, loc_params2.loc_data.loc_by_name.name = new_name; loc_params2.loc_data.loc_by_name.lapl_id = lapl_id; - if(H5L_SAME_LOC != obj_id) { + if(H5L_SAME_LOC != obj_id) /* get the location object */ if(NULL == (vol_obj1 = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - if(H5L_SAME_LOC != new_loc_id) { + if(H5L_SAME_LOC != new_loc_id) /* get the location object */ if(NULL == (vol_obj2 = H5VL_vol_object(new_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - /* Make sure that the VOL plugins are the same */ - if(vol_obj1 && vol_obj2) { - if (vol_obj1->driver->cls->value != vol_obj2->driver->cls->value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") - } + + /* Make sure that the VOL connectors are the same */ + if(vol_obj1 && vol_obj2) + if (vol_obj1->connector->cls->value != vol_obj2->connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL connectors and can't be linked") /* Get the plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) @@ -374,10 +371,12 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, if(H5P_set(plist, H5VL_PROP_LINK_TARGET_LOC_PARAMS, &loc_params1) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id") + /* Construct a temporary VOL object */ + tmp_vol_obj.data = vol_obj2->data; + tmp_vol_obj.connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector); + /* Create a link to the object */ - if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2->data, loc_params2, - (vol_obj1 != NULL ? vol_obj1->driver->cls : vol_obj2->driver->cls), - lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link") done: @@ -408,7 +407,7 @@ done: herr_t H5Oincr_refcount(hid_t object_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; @@ -427,8 +426,7 @@ H5Oincr_refcount(hid_t object_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Change the object's reference count */ - if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_OBJECT_CHANGE_REF_COUNT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, 1) < 0) + if(H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_CHANGE_REF_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, 1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: @@ -459,7 +457,7 @@ done: herr_t H5Odecr_refcount(hid_t object_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -478,8 +476,7 @@ H5Odecr_refcount(hid_t object_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Change the object's reference count */ - if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_OBJECT_CHANGE_REF_COUNT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, -1) < 0) + if(H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_CHANGE_REF_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, -1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: @@ -503,7 +500,7 @@ done: htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; htri_t ret_value = FAIL; /* Return value */ @@ -531,8 +528,7 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) loc_params.obj_type = H5I_get_type(loc_id); /* Check if the object exists */ - if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_OBJECT_EXISTS, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) done: @@ -557,7 +553,7 @@ done: herr_t H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -579,8 +575,7 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -606,7 +601,7 @@ herr_t H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, unsigned fields, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -638,8 +633,7 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: @@ -667,7 +661,7 @@ herr_t H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -704,8 +698,7 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -733,7 +726,7 @@ done: herr_t H5Oset_comment(hid_t obj_id, const char *comment) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -753,8 +746,7 @@ H5Oset_comment(hid_t obj_id, const char *comment) loc_params.obj_type = H5I_get_type(obj_id); /* (Re)set the object's comment */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object") done: @@ -783,7 +775,7 @@ herr_t H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ @@ -809,8 +801,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* (Re)set the object's comment */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name) done: @@ -837,7 +828,7 @@ done: ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; ssize_t ret_value = -1; /* Return value */ @@ -845,7 +836,7 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) H5TRACE3("Zs", "i*sz", obj_id, comment, bufsize); /* Get the object */ - if (NULL == (vol_obj = H5VL_vol_object(obj_id))) + if(NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Set fields in the location struct */ @@ -853,8 +844,7 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) loc_params.obj_type = H5I_get_type(obj_id); /* Retrieve the object's comment */ - if (H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object") done: @@ -882,7 +872,7 @@ ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t bufsize, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; ssize_t ret_value = -1; /* Return value */ @@ -908,8 +898,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Retrieve the object's comment */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object: '%s'", name) done: @@ -956,7 +945,7 @@ herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value; /* Return value */ @@ -982,9 +971,7 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, loc_params.obj_type = H5I_get_type(obj_id); /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, - H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - idx_type, order, op, op_data, fields)) < 0) + if((ret_value = H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") done: @@ -1031,7 +1018,7 @@ herr_t H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields, hid_t lapl_id) { - H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; herr_t ret_value; /* Return value */ @@ -1068,9 +1055,7 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, - H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - idx_type, order, op, op_data, fields)) < 0) + if((ret_value = H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") done: diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 1d509e5..6e135c5 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -1304,7 +1304,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, H5_index_t idx_type, /* Iterate over attributes in table */ if((ret_value = H5A__attr_iterate_table(&atable, skip, last_attr, loc_id, attr_op, op_data)) < 0) - HERROR(H5E_ATTR, H5E_CANTNEXT, "iteration operator failed"); + HERROR(H5E_ATTR, H5E_BADITER, "iteration operator failed"); } /* end else */ done: diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index c03c352..213a697 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -247,9 +247,7 @@ 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); /* Copy the object */ - if((ret_value = H5VL_object_copy(vol_obj1->data, loc_params1, vol_obj1->driver->cls, src_name, - vol_obj2->data, loc_params2, vol_obj2->driver->cls, dst_name, - ocpypl_id, lcpl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if(H5VL_object_copy(vol_obj1, loc_params1, src_name, vol_obj2, loc_params2, dst_name, ocpypl_id, lcpl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") done: diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index 68eb170..dca1835 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -109,8 +109,7 @@ H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -161,8 +160,7 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: @@ -223,8 +221,7 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -292,9 +289,7 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, loc_params.obj_type = H5I_get_type(obj_id); /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, - H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) + if((ret_value = H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: @@ -373,9 +368,7 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, - H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) + if((ret_value = H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: diff --git a/src/H5Oflush.c b/src/H5Oflush.c index 40b6c6e..4b429f8 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -92,8 +92,7 @@ H5Oflush(hid_t obj_id) loc_params.obj_type = H5I_get_type(obj_id); /* Flush the object */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, - H5VL_OBJECT_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_id)) < 0) + if(H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") done: @@ -257,8 +256,7 @@ H5Orefresh(hid_t oid) loc_params.obj_type = H5I_get_type(oid); /* Refresh the object */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, - H5VL_OBJECT_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oid)) < 0) + if(H5VL_object_specific(vol_obj, loc_params, H5VL_OBJECT_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oid) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") done: @@ -301,7 +299,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) H5O_loc_t obj_oloc; H5G_name_t obj_path; H5O_shared_t cached_H5O_shared; - H5VL_t *driver = NULL; + H5VL_t *connector = NULL; /* Create empty object location */ obj_loc.oloc = &obj_oloc; @@ -319,29 +317,29 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) if(H5T_save_refresh_state(oid, &cached_H5O_shared) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to save datatype state") - /* Get the VOL object from the ID and cache a pointer to the driver. + /* Get the VOL object from the ID and cache a pointer to the connector. * The vol_obj will disappear when the underlying object is closed, so * we can't use that directly. */ if(NULL == (vol_obj = H5VL_vol_object(oid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - driver = vol_obj->driver; + connector = vol_obj->connector; - /* Bump the number of references on the VOL driver. - * If you don't do this, VDS refreshes can accidentally close the driver. + /* Bump the number of references on the VOL connector. + * If you don't do this, VDS refreshes can accidentally close the connector. */ - driver->nrefs++; + connector->nrefs++; /* Close object & evict its metadata */ if((H5O__refresh_metadata_close(oid, oloc, &obj_loc)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") /* Re-open the object, re-fetching its metadata */ - if((H5O_refresh_metadata_reopen(oid, &obj_loc, driver, FALSE)) < 0) + if((H5O_refresh_metadata_reopen(oid, &obj_loc, connector, FALSE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") - /* Restore the number of references on the VOL driver */ - driver->nrefs--; + /* Restore the number of references on the VOL connector */ + connector->nrefs--; /* Restore important datatype state */ if(H5I_get_type(oid) == H5I_DATATYPE) @@ -444,7 +442,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, hbool_t start_swmr) +H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_connector, hbool_t start_swmr) { void *object = NULL; /* Object for this operation */ H5I_type_t type; /* Type of object for the ID */ @@ -454,7 +452,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, h /* Sanity check */ HDassert(obj_loc); - HDassert(vol_driver); + HDassert(vol_connector); /* Get object's type */ type = H5I_get_type(oid); @@ -463,13 +461,13 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, h case H5I_GROUP: /* Re-open the group */ if(NULL == (object = H5G_open(obj_loc))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open group") break; case H5I_DATATYPE: /* Re-open the named datatype */ if(NULL == (object = H5T_open(obj_loc))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to open named datatype") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open named datatype") break; case H5I_DATASET: @@ -478,7 +476,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, h HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset") if(!start_swmr) /* No need to handle multiple opens when H5Fstart_swmr_write() */ if(H5D_mult_refresh_reopen((H5D_t *)object) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to finish refresh for dataset") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to finish refresh for dataset") break; case H5I_UNINIT: @@ -496,13 +494,13 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, h case H5I_ERROR_STACK: case H5I_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid file object ID (dataset, group, or datatype)") + HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "not a valid file object ID (dataset, group, or datatype)") break; } /* end switch */ /* Re-register ID for the object */ - if((H5VL_register_using_existing_id(type, object, vol_driver, TRUE, oid)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to re-register object ID after refresh") + if((H5VL_register_using_existing_id(type, object, vol_connector, TRUE, oid)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, FAIL, "unable to re-register object ID after refresh") done: FUNC_LEAVE_NOAPI(ret_value); diff --git a/src/H5Oint.c b/src/H5Oint.c index 30fe127..059a8a8 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -2114,7 +2114,7 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields) /* Set the object's reference count */ oinfo->rc = oh->nlink; - } + } /* end if */ /* Get time information, if requested */ if(fields & H5O_INFO_TIME) { @@ -2658,7 +2658,7 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") /* Get an ID for the visited object */ - if((obj_id = H5VL_native_register(opened_type, obj, TRUE)) < 0) + if((obj_id = H5VL_wrap_register(opened_type, obj, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register visited object") /* Make callback for starting object */ diff --git a/src/H5Olink.c b/src/H5Olink.c index 6447936..55e1aee 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -612,6 +612,7 @@ herr_t H5O_link_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) { H5O_link_t *lnk = (H5O_link_t *)_mesg; + hid_t file_id = -1; /* ID for the file the link is located in (passed to user callback) */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -645,25 +646,21 @@ H5O_link_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) /* Check for delete callback */ if(link_class->del_func) { - hid_t file_id; /* ID for the file the link is located in (passed to user callback) */ - /* Get a file ID for the file the link is in */ - if((file_id = H5F_get_id(f, FALSE)) < 0) + if((file_id = H5F_get_id(f)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get file ID") /* Call user-defined link's 'delete' callback */ - if((link_class->del_func)(lnk->name, file_id, lnk->u.ud.udata, lnk->u.ud.size) < 0) { - H5I_dec_ref(file_id); + if((link_class->del_func)(lnk->name, file_id, lnk->u.ud.udata, lnk->u.ud.size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CALLBACK, FAIL, "link deletion callback returned failure") - } /* end if */ - - /* Release the file ID */ - if(H5I_dec_ref(file_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file") } /* end if */ } /* end if */ done: + /* Release the file ID */ + if(file_id > 0 && H5I_dec_ref(file_id) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_link_delete() */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 7254edb..dbc8089 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -414,13 +414,6 @@ typedef struct H5O_chk_cache_ud_t { H5O_common_cache_ud_t common; /* Common object header cache callback info */ } H5O_chk_cache_ud_t; -/* types for object optional VOL operations */ -typedef enum H5VL_object_optional_t { - H5VL_OBJECT_GET_COMMENT, /* get object comment */ - H5VL_OBJECT_GET_INFO, /* get object info */ - H5VL_OBJECT_SET_COMMENT /* set object comment */ -} H5VL_object_optional_t; - /* Header message ID to class mapping */ H5_DLLVAR const H5O_msg_class_t *const H5O_msg_class_g[H5O_MSG_TYPES]; diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 048e13e..e8565b9 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -851,6 +851,12 @@ typedef struct { } u; } H5O_mesg_operator_t; +/* Types for object optional VOL operations */ +typedef enum H5VL_object_optional_t { + H5VL_OBJECT_GET_COMMENT, /* get object comment */ + H5VL_OBJECT_GET_INFO, /* get object info */ + H5VL_OBJECT_SET_COMMENT /* set object comment */ +} H5VL_object_optional_t; /* Typedef for abstract object creation */ typedef struct { diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index a50c5ee..820c291 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -39,17 +39,17 @@ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory Management */ #include "H5Ppkg.h" /* Property lists */ -#include "H5VLprivate.h" /* VOL drivers */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /* Includes needed to set as default file driver */ -#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */ +#include "H5FDsec2.h" /* POSIX unbuffered I/O */ #include "H5FDstdio.h" /* Standard C buffered I/O */ #ifdef H5_HAVE_WINDOWS #include "H5FDwindows.h" /* Win32 I/O */ #endif -/* Includes needed to set the default VOL driver */ -#include "H5VLnative_private.h" /* Native VOL driver */ +/* Includes needed to set the default VOL connector */ +#include "H5VLnative_private.h" /* Native VOL connector */ /****************/ @@ -262,16 +262,16 @@ #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF 0 #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC H5P__encode_unsigned #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC H5P__decode_unsigned -/* Definition for file VOL driver properties (ID, etc.) */ -#define H5F_ACS_VOL_SIZE sizeof(H5VL_driver_prop_t) -#define H5F_ACS_VOL_DEF {H5_DEFAULT_VOL, NULL} -#define H5F_ACS_VOL_CRT H5P__facc_vol_create -#define H5F_ACS_VOL_SET H5P__facc_vol_set -#define H5F_ACS_VOL_GET H5P__facc_vol_get -#define H5F_ACS_VOL_DEL H5P__facc_vol_del -#define H5F_ACS_VOL_COPY H5P__facc_vol_copy -#define H5F_ACS_VOL_CMP H5P__facc_vol_cmp -#define H5F_ACS_VOL_CLOSE H5P__facc_vol_close +/* Definition for file VOL connector properties (ID, etc.) */ +#define H5F_ACS_VOL_CONN_SIZE sizeof(H5VL_connector_prop_t) +#define H5F_ACS_VOL_CONN_DEF {H5_DEFAULT_VOL, NULL} +#define H5F_ACS_VOL_CONN_CRT H5P__facc_vol_create +#define H5F_ACS_VOL_CONN_SET H5P__facc_vol_set +#define H5F_ACS_VOL_CONN_GET H5P__facc_vol_get +#define H5F_ACS_VOL_CONN_DEL H5P__facc_vol_del +#define H5F_ACS_VOL_CONN_COPY H5P__facc_vol_copy +#define H5F_ACS_VOL_CONN_CMP H5P__facc_vol_cmp +#define H5F_ACS_VOL_CONN_CLOSE H5P__facc_vol_close /******************/ @@ -334,7 +334,7 @@ static int H5P__facc_cache_image_config_cmp(const void *_config1, const void *_c static herr_t H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__facc_cache_image_config_dec(const void **_pp, void *_value); -/* VOL driver callbacks */ +/* VOL connector callbacks */ static herr_t H5P__facc_vol_create(const char *name, size_t size, void *value); static herr_t H5P__facc_vol_set(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__facc_vol_get(hid_t prop_id, const char *name, size_t size, void *value); @@ -437,7 +437,7 @@ static herr_t H5P__facc_reg_prop(H5P_genclass_t *pclass) { const H5FD_driver_prop_t def_driver_prop = H5F_ACS_FILE_DRV_DEF; /* Default VFL driver ID & info (initialized from a variable) */ - const H5VL_driver_prop_t def_vol_prop = H5F_ACS_VOL_DEF; /* Default VOL driver ID & info (initialized from a variable) */ + const H5VL_connector_prop_t def_vol_prop = H5F_ACS_VOL_CONN_DEF; /* Default VOL connector ID & info (initialized from a variable) */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -668,11 +668,11 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register the file VOL driver ID & info */ + /* Register the file VOL connector ID & info */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P__register_real(pclass, H5F_ACS_VOL_DRV_NAME, H5F_ACS_VOL_SIZE, &def_vol_prop, - H5F_ACS_VOL_CRT, H5F_ACS_VOL_SET, H5F_ACS_VOL_GET, NULL, NULL, - H5F_ACS_VOL_DEL, H5F_ACS_VOL_COPY, H5F_ACS_VOL_CMP, H5F_ACS_VOL_CLOSE) < 0) + if(H5P__register_real(pclass, H5F_ACS_VOL_CONN_NAME, H5F_ACS_VOL_CONN_SIZE, &def_vol_prop, + H5F_ACS_VOL_CONN_CRT, H5F_ACS_VOL_CONN_SET, H5F_ACS_VOL_CONN_GET, NULL, NULL, + H5F_ACS_VOL_CONN_DEL, H5F_ACS_VOL_CONN_COPY, H5F_ACS_VOL_CONN_CMP, H5F_ACS_VOL_CONN_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: @@ -4974,10 +4974,10 @@ done: /*------------------------------------------------------------------------- * Function: H5P_set_vol * - * Purpose: Set the VOL driver for a file access property list - * (PLIST_ID). The vol properties will + * Purpose: Set the VOL connector for a file access property list + * (PLIST_ID). The VOL properties will * be copied into the property list and the reference count on - * the vol will be incremented. + * the VOL will be incremented. * * Return: SUCCEED/FAIL * @@ -4991,19 +4991,19 @@ H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info) FUNC_ENTER_NOAPI(FAIL) if(NULL == H5I_object_verify(vol_id, H5I_VOL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - H5VL_driver_prop_t vol_prop; /* Property for VOL ID & info */ + H5VL_connector_prop_t vol_prop; /* Property for VOL ID & info */ - /* Prepare the VOL driver property */ - vol_prop.driver_id = vol_id; - vol_prop.driver_info = vol_info; + /* Prepare the VOL connector property */ + vol_prop.connector_id = vol_id; + vol_prop.connector_info = vol_info; - /* Set the driver ID & info property */ - if(H5P_set(plist, H5F_ACS_VOL_DRV_NAME, &vol_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL driver ID & info") - } + /* Set the connector ID & info property */ + if(H5P_set(plist, H5F_ACS_VOL_CONN_NAME, &vol_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL connector ID & info") + } /* end if */ else HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); @@ -5015,7 +5015,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Pset_vol * - * Purpose: Set the file VOL driver (VOL_ID) for a file access + * Purpose: Set the file VOL connector (VOL_ID) for a file access * property list (PLIST_ID) * * Return: Success: Non-negative @@ -5036,11 +5036,11 @@ H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info) if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") if(NULL == H5I_object_verify(new_vol_id, H5I_VOL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file vol ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file VOL ID") - /* Set the vol */ + /* Set the VOL */ if(H5P_set_vol(plist, new_vol_id, new_vol_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vol") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL") done: FUNC_LEAVE_API(ret_value) @@ -5048,75 +5048,103 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_get_vol_info + * Function: H5Pget_vol_id * - * Purpose: Returns a pointer directly to the file vol-specific - * information of a file access property list. + * Purpose: Returns the ID of the current VOL connector. + * This ID should be closed with H5VLclose(). * - * Return: Success: Ptr to *uncopied* vol specific data - * structure if any. - * - * Failure: NULL. Null is also returned if the vol has - * not registered any vol-specific properties - * although no error is pushed on the stack in - * this case. + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ -void * -H5P_get_vol_info(H5P_genplist_t *plist) +herr_t +H5Pget_vol_id(hid_t plist_id, hid_t *vol_id) { - void *ret_value = NULL; + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*i", plist_id, vol_id); + + /* Get property list for ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - /* Get the current vol info */ + /* Get the current VOL ID */ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + + /* Get the connector property */ + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector info") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol driver info") - ret_value = (void *)driver_prop.driver_info; - } else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + /* Increment the VOL ID's ref count */ + if(H5I_inc_ref(connector_prop.connector_id, TRUE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL connector ID") + + /* Set the connector ID to return */ + *vol_id = connector_prop.connector_id; + } /* end if */ + else + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_get_vol_info() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_vol_id() */ /*------------------------------------------------------------------------- * Function: H5Pget_vol_info * - * Purpose: Returns a pointer directly to the file vol-specific - * information of a file access property list. - * - * XXX (VOL MERGE): This API call seems like a REALLY bad idea - DER - * - * Return: Success: Ptr to *uncopied* vol specific data - * structure if any. + * Purpose: Returns a copy of the VOL info for a connector. + * This information should be freed with H5VLfree_connector_info. * - * Failure: NULL. Null is also returned if the vol has - * not registered any vol-specific properties - * although no error is pushed on the stack in - * this case. + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ -void * -H5Pget_vol_info(hid_t plist_id) +herr_t +H5Pget_vol_info(hid_t plist_id, void **vol_info) { - H5P_genplist_t *plist; /* Property list pointer */ - void *ret_value; /* Return value */ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(NULL) - H5TRACE1("*x", "i", plist_id); + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i**x", plist_id, vol_info); + /* Get property list for ID */ if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Get the current VOL info */ + if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { + void *new_connector_info = NULL; /* Copy of connector info */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - if(NULL == (ret_value = H5P_get_vol_info(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol info") + /* Get the connector property */ + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector info") + + /* Copy connector info, if it exists */ + if(connector_prop.connector_info) { + H5VL_class_t *connector; /* Pointer to connector */ + + /* Retrieve the connector for the ID */ + if(NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop.connector_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Allocate and copy connector info */ + if(H5VL_copy_connector_info(connector, &new_connector_info, connector_prop.connector_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "connector info copy failed") + } /* end if */ + + /* Set the connector info */ + *vol_info = new_connector_info; + } /* end if */ + else + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") done: FUNC_LEAVE_API(ret_value) @@ -5126,7 +5154,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__vol_copy * - * Purpose: Copy VOL driver ID & info. + * Purpose: Copy VOL connector ID & info. * * Note: This is an "in-place" copy, since this routine gets called * after the top-level copy has been performed and this routine @@ -5145,41 +5173,32 @@ H5P__vol_copy(void *value) FUNC_ENTER_STATIC if(value) { - H5VL_driver_prop_t *info = (H5VL_driver_prop_t *)value; /* Driver ID & info struct */ + H5VL_connector_prop_t *connector_prop = (H5VL_connector_prop_t *)value; /* connector ID & info struct */ - /* Copy the driver ID & info, if there is one */ - if(info->driver_id > 0) { - /* Increment the reference count on driver ID and copy driver info */ - if(H5I_inc_ref(info->driver_id, FALSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL driver ID") + /* Copy the connector ID & info, if there is one */ + if(connector_prop->connector_id > 0) { + /* Increment the reference count on connector ID and copy connector info */ + if(H5I_inc_ref(connector_prop->connector_id, FALSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL connector ID") - /* Copy driver info, if it exists */ - if(info->driver_info) { - H5VL_class_t *driver; /* Pointer to driver */ - void *new_driver; /* Copy of driver info */ + /* Copy connector info, if it exists */ + if(connector_prop->connector_info) { + H5VL_class_t *connector; /* Pointer to connector */ + void *new_connector_info = NULL; /* Copy of connector info */ - /* Retrieve the driver for the ID */ - if(NULL == (driver = (H5VL_class_t *)H5I_object(info->driver_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL driver ID") + /* Retrieve the connector for the ID */ + if(NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop->connector_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID") - /* Allow the driver to copy or do it ourselves */ - if(driver->fapl_copy) { - if(NULL == (new_driver = (driver->fapl_copy)(info->driver_info))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "driver info copy failed") - } - else if(driver->fapl_size > 0) { - if(NULL == (new_driver = H5MM_malloc(driver->fapl_size))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "driver info allocation failed") - HDmemcpy(new_driver, info->driver_info, driver->fapl_size); - } - else - HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, "no way to copy driver info") + /* Allocate and copy connector info */ + if(H5VL_copy_connector_info(connector, &new_connector_info, connector_prop->connector_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "connector info copy failed") - /* Set the driver info for the copy */ - info->driver_info = new_driver; - } - } - } + /* Set the connector info to the copy */ + connector_prop->connector_info = new_connector_info; + } /* end if */ + } /* end if */ + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -5189,7 +5208,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__vol_free * - * Purpose: Free VOL driver ID & info. + * Purpose: Free VOL connector ID & info. * * Return: Success: Non-negative * Failure: Negative @@ -5204,31 +5223,27 @@ H5P__vol_free(void *value) FUNC_ENTER_STATIC if(value) { - H5VL_driver_prop_t *info = (H5VL_driver_prop_t *)value; /* Driver ID & info struct */ + H5VL_connector_prop_t *info = (H5VL_connector_prop_t *)value; /* connector ID & info struct */ - /* Free the driver info (if it exists) and decrement the ID */ - if(info->driver_id > 0) { - if(info->driver_info) { - H5VL_class_t *driver; /* Pointer to driver */ + /* Free the connector info (if it exists) and decrement the ID */ + if(info->connector_id > 0) { + if(info->connector_info) { + H5VL_class_t *connector; /* Pointer to connector */ - /* Retrieve the driver for the ID */ - if(NULL == (driver = (H5VL_class_t *)H5I_object(info->driver_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL driver ID") + /* Retrieve the connector for the ID */ + if(NULL == (connector = (H5VL_class_t *)H5I_object(info->connector_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID") - /* Allow the driver to free info or do it ourselves */ - if(driver->fapl_free) { - if((driver->fapl_free)((void *)info->driver_info) < 0) /* Casting away const OK -QAK */ - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed") - } - else - H5MM_xfree((void *)info->driver_info); /* Casting away const OK -QAK */ - } + /* Free the connector info */ + if(H5VL_free_connector_info(connector, (void *)info->connector_info) < 0) /* Casting away const OK - QAK */ + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") + } /* end if */ - /* Decrement reference count for driver ID */ - if(H5I_dec_ref(info->driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for driver ID") - } - } + /* Decrement reference count for connector ID */ + if(H5I_dec_ref(info->connector_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for connector ID") + } /* end if */ + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -5238,7 +5253,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_create * - * Purpose: Create callback for the VOL driver ID & info property. + connectorose: Create callback for the VOL connector ID & info property. * * Return: Success: Non-negative * Failure: Negative @@ -5252,9 +5267,9 @@ H5P__facc_vol_create(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size FUNC_ENTER_STATIC - /* Make copy of the VOL driver */ + /* Make copy of the VOL connector */ if(H5P__vol_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5264,7 +5279,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_set * - * Purpose: Copies a VOL driver property when it's set for a property list + * Purpose: Copies a VOL connector property when it's set for a property list * * Return: Success: Non-negative * Failure: Negative @@ -5282,9 +5297,9 @@ H5P__facc_vol_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, /* Sanity check */ HDassert(value); - /* Make copy of VOL driver ID & info */ + /* Make copy of VOL connector ID & info */ if(H5P__vol_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5294,7 +5309,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_get * - * Purpose: Copies a VOL driver property when it's retrieved from a property list + * Purpose: Copies a VOL connector property when it's retrieved from a property list * * Return: Success: Non-negative * Failure: Negative @@ -5312,9 +5327,9 @@ H5P__facc_vol_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, /* Sanity check */ HDassert(value); - /* Make copy of VOL driver */ + /* Make copy of VOL connector */ if(H5P__vol_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5324,7 +5339,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_del * - * Purpose: Frees memory used to store the VOL driver ID & info property + * Purpose: Frees memory used to store the VOL connector ID & info property * * Return: Success: Non-negative * Failure: Negative @@ -5338,9 +5353,9 @@ H5P__facc_vol_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, FUNC_ENTER_STATIC - /* Free the VOL driver ID & info */ + /* Free the VOL connector ID & info */ if(H5P__vol_free(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL connector") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5350,7 +5365,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_copy * - * Purpose: Copy callback for the VOL driver ID & info property. + * Purpose: Copy callback for the VOL connector ID & info property. * * Return: Success: Non-negative * Failure: Negative @@ -5364,9 +5379,9 @@ H5P__facc_vol_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, FUNC_ENTER_STATIC - /* Make copy of VOL driver */ + /* Make copy of VOL connector */ if(H5P__vol_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5376,7 +5391,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_cmp * - * Purpose: Callback routine which is called whenever the VOL driver + * Purpose: Callback routine which is called whenever the VOL connector * ID & info property in the file access property list * is compared. * @@ -5389,48 +5404,39 @@ done: static int H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED size) { - const H5VL_driver_prop_t *info1 = (const H5VL_driver_prop_t *)_info1; /* Create local aliases for values */ - const H5VL_driver_prop_t *info2 = (const H5VL_driver_prop_t *)_info2; - H5VL_class_t *cls1, *cls2; /* Driver class for each property */ + const H5VL_connector_prop_t *info1 = (const H5VL_connector_prop_t *)_info1; /* Create local aliases for values */ + const H5VL_connector_prop_t *info2 = (const H5VL_connector_prop_t *)_info2; + H5VL_class_t *cls1, *cls2; /* connector class for each property */ int cmp_value; /* Value from comparison */ - herr_t ret_value = 0; /* Return value */ + int ret_value = 0; /* Return value */ FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(info1); HDassert(info2); - HDassert(size == sizeof(H5VL_driver_prop_t)); + HDassert(size == sizeof(H5VL_connector_prop_t)); - /* Compare drivers */ - if(NULL == (cls1 = (H5VL_class_t *)H5I_object(info1->driver_id))) + /* Compare connectors */ + if(NULL == (cls1 = (H5VL_class_t *)H5I_object(info1->connector_id))) HGOTO_DONE(-1) - if(NULL == (cls2 = (H5VL_class_t *)H5I_object(info2->driver_id))) + if(NULL == (cls2 = (H5VL_class_t *)H5I_object(info2->connector_id))) HGOTO_DONE(1) - if(cls1->name == NULL && cls2->name != NULL) - HGOTO_DONE(-1); - if(cls1->name != NULL && cls2->name == NULL) - HGOTO_DONE(1); - if(0 != (cmp_value = HDstrcmp(cls1->name, cls2->name))) + if(0 != (cmp_value = H5VL_cmp_connector_cls(cls1, cls2))) HGOTO_DONE(cmp_value); - /* Compare driver info */ - if(cls1->fapl_size < cls2->fapl_size) - HGOTO_DONE(-1) - if(cls1->fapl_size > cls2->fapl_size) - HGOTO_DONE(1) - HDassert(cls1->fapl_size == cls2->fapl_size); + /* At this point, we should be able to assume that we are dealing with + * the same connector class struct (or a copies of the same class struct) + */ - if(info1->driver_info == NULL && info2->driver_info != NULL) - HGOTO_DONE(-1); - if(info1->driver_info != NULL && info2->driver_info == NULL) - HGOTO_DONE(1); - if(info1->driver_info) { - HDassert(cls1->fapl_size > 0); - if(0 != (cmp_value = HDmemcmp(info1->driver_info, info2->driver_info, cls1->fapl_size))) - HGOTO_DONE(cmp_value); - } + /* Use one of the classes (cls1) info comparison routines to compare the + * info objects + */ + HDassert(cls1->info_cmp == cls2->info_cmp); + if(0 != (cmp_value = H5VL_cmp_connector_info(cls1, info1->connector_info, info2->connector_info))) + HGOTO_DONE(cmp_value); + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_vol_cmp() */ @@ -5439,7 +5445,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_close * - * Purpose: Close callback for the VOL driver ID & info property. + * Purpose: Close callback for the VOL connector ID & info property. * * Return: Success: Non-negative * Failure: Negative @@ -5453,9 +5459,9 @@ H5P__facc_vol_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, FUNC_ENTER_STATIC - /* Free the VOL driver */ + /* Free the VOL connector */ if(H5P__vol_free(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL connector") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c index 6568ecd..16be52a 100644 --- a/src/H5Plcpl.c +++ b/src/H5Plcpl.c @@ -55,7 +55,7 @@ /* Definitions for Location params */ #define H5L_CRT_LOCATION_SIZE sizeof(H5VL_loc_params_t) -#define H5L_CRT_LOCATION_DEF {H5I_BADID, H5VL_OBJECT_BY_SELF, {HADDR_UNDEF}} +#define H5L_CRT_LOCATION_DEF {H5I_BADID, H5VL_OBJECT_BY_SELF, {{HADDR_UNDEF}}} /* Definitions for target object NAME */ #define H5L_CRT_TARGET_NAME_SIZE sizeof(char *) diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index cd749cb..866f088 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -178,7 +178,6 @@ H5_DLL const void *H5P_peek_driver_info(H5P_genplist_t *plist); H5_DLL herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_driver_info); H5_DLL herr_t H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info); -H5_DLL void * H5P_get_vol_info(H5P_genplist_t *plist); H5_DLL herr_t H5P_set_vlen_mem_manager(H5P_genplist_t *plist, H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func, void *free_info); diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 77d8ebb..86c6687 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -314,7 +314,8 @@ H5_DLL herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id, H5_DLL hid_t H5Pget_driver(hid_t plist_id); H5_DLL const void *H5Pget_driver_info(hid_t plist_id); H5_DLL herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info); -H5_DLL void *H5Pget_vol_info(hid_t plist_id); +H5_DLL herr_t H5Pget_vol_id(hid_t plist_id, hid_t *vol_id); +H5_DLL herr_t H5Pget_vol_info(hid_t plist_id, void **vol_info); H5_DLL herr_t H5Pset_family_offset(hid_t fapl_id, hsize_t offset); H5_DLL herr_t H5Pget_family_offset(hid_t fapl_id, hsize_t *offset); H5_DLL herr_t H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type); @@ -127,9 +127,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info") /* Create reference */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_REF_CREATE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - ref, name, ref_type, space_id)) < 0) + if((ret_value = H5VL_object_specific(vol_obj, loc_params, H5VL_REF_CREATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, ref, name, ref_type, space_id)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create reference") done: @@ -200,12 +198,11 @@ 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); /* Dereference */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, - &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (opened_obj = H5VL_object_open(vol_obj, loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object") - if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") + if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") done: FUNC_LEAVE_API(ret_value) @@ -260,8 +257,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Get the dataspace with the correct region selected */ - if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_REF_GET_REGION, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, ref_type, ref) < 0) + if(H5VL_object_get(vol_obj, loc_params, H5VL_REF_GET_REGION, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, ref_type, ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve dataspace") done: @@ -318,9 +314,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Get the object type */ - if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->driver->cls, - H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, obj_type, ref_type, ref) < 0) + if(H5VL_object_get(vol_obj, loc_params, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, ref_type, ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type") done: @@ -387,9 +381,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get name */ - if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_REF_GET_NAME, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - &ret_value, name, size, ref_type, _ref) < 0) + if(H5VL_object_get(vol_obj, loc_params, H5VL_REF_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size, ref_type, _ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to determine object path") done: diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index f224cda..ba71a4b 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -37,13 +37,13 @@ #include "H5Ppublic.h" /* Property lists */ /* Private headers needed by this file */ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gprivate.h" /* Groups */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gprivate.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ -#include "H5Oprivate.h" /* Object headers */ +#include "H5Oprivate.h" /* Object headers */ #include "H5Rpkg.h" /* References */ @@ -126,8 +126,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid file identifier") /* Get the object information */ - if (H5VL_object_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_REF_GET_TYPE, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_type, ref_type, ref) < 0) + if(H5VL_object_get(vol_obj, loc_params, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_type, ref_type, ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5G_UNKNOWN, "unable to determine object type") /* Set return value */ @@ -183,13 +182,12 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) loc_params.obj_type = H5I_get_type(obj_id); /* Dereference */ - if (NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, &opened_type, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (opened_obj = H5VL_object_open(vol_obj, loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object") /* Get an atom for the object */ - if ((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") + if((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Rint.c b/src/H5Rint.c index 52a4ee1..365facd 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -692,9 +692,9 @@ done: REVISION LOG --------------------------------------------------------------------------*/ ssize_t -H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref, char *name, size_t size) +H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref, + char *name, size_t size) { - hid_t file_id = H5I_INVALID_HID; /* ID for file that the reference is in */ H5O_loc_t oloc; /* Object location describing object for reference */ ssize_t ret_value = -1; /* Return value */ @@ -728,7 +728,7 @@ H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref, char *name, size_ UINT32DECODE(p, hobjid.idx); /* Get the dataset region from the heap (allocate inside routine) */ - if ((buf = (uint8_t *)H5HG_read(oloc.file, &hobjid, NULL, NULL)) == NULL) + if((buf = (uint8_t *)H5HG_read(oloc.file, &hobjid, NULL, NULL)) == NULL) HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, (-1), "Unable to read dataset region information") /* Get the object oid for the dataset */ @@ -747,19 +747,11 @@ H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref, char *name, size_ HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, (-1), "internal error (unknown reference type)") } /* end switch */ - /* Retrieve file ID for name search */ - if ((file_id = H5F_get_id(f, FALSE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't get file ID") - /* Get name, length, etc. */ - if ((ret_value = H5G_get_name_by_addr(file_id, &oloc, name, size)) < 0) + if((ret_value = H5G_get_name_by_addr(f, &oloc, name, size)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't determine name") done: - /* Close file ID used for search */ - if (file_id > 0 && H5I_dec_ref(file_id) < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, (-1), "can't decrement ref count of temp ID") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__get_name() */ @@ -1609,23 +1609,22 @@ H5T__close_cb(H5T_t *dt) HDassert(dt->shared); /* If this datatype is VOL-managed (i.e.: has a VOL object), - * close it through the VOL driver. + * close it through the VOL connector. */ if(NULL != dt->vol_obj) { - - /* Close the driver-managed datatype data */ - if(H5VL_datatype_close(dt->vol_obj->data, dt->vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype"); + /* Close the connector-managed datatype data */ + if(H5VL_datatype_close(dt->vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype") /* Free the VOL object */ if(H5VL_free_object(dt->vol_obj) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object"); + HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object") dt->vol_obj = NULL; - } + } /* end if */ /* Close the datatype */ if(H5T_close(dt) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1745,7 +1744,7 @@ H5Tcopy(hid_t type_id) /* Copy datatype */ if(NULL == (new_dt = H5T_copy(dt, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy") /* Atomize result */ if((ret_value = H5I_register(H5I_DATATYPE, new_dt, TRUE)) < 0) @@ -2264,30 +2263,30 @@ done: * the return value is an integer type. * * Return: Success: Data type for base data type. - * * Failure: NULL * * Programmer: Raymond Lu - * October 9, 2002 + * October 9, 2002 + * *------------------------------------------------------------------------- */ H5T_t * H5T_get_super(const H5T_t *dt) { - H5T_t *ret_value=NULL; + H5T_t *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) HDassert(dt); - if (!dt->shared->parent) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a derived data type"); - if (NULL==(ret_value=H5T_copy(dt->shared->parent, H5T_COPY_ALL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy parent data type"); + if(!dt->shared->parent) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a derived data type") + if(NULL == (ret_value = H5T_copy(dt->shared->parent, H5T_COPY_ALL))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy parent data type") done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_get_super() */ /*------------------------------------------------------------------------- @@ -3108,7 +3107,7 @@ H5T__create(H5T_class_t type, size_t size) /* Copy the default string datatype */ if(NULL == (dt = H5T_copy(origin_dt, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy") /* Modify the datatype */ if(H5T__set_size(dt, size) < 0) @@ -3230,9 +3229,9 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) /* Allocate space */ if(NULL == (new_dt = H5FL_MALLOC(H5T_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") if(NULL == (new_dt->shared = H5FL_MALLOC(H5T_shared_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy shared information (entry information is copied last) */ *(new_dt->shared) = *(old_dt->shared); @@ -3273,7 +3272,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) /* Open named datatype again */ if(H5O_open(&old_dt->oloc) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reopen named data type"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reopen named data type") /* Insert opened named datatype into opened object list for the file */ if(H5FO_insert(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr, new_dt->shared, FALSE)<0) @@ -3337,7 +3336,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) new_dt->shared->u.compnd.memb = (H5T_cmemb_t *)H5MM_malloc(new_dt->shared->u.compnd.nalloc * sizeof(H5T_cmemb_t)); if (NULL == new_dt->shared->u.compnd.memb) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDmemcpy(new_dt->shared->u.compnd.memb, old_dt->shared->u.compnd.memb, new_dt->shared->u.compnd.nmembs * sizeof(H5T_cmemb_t)); @@ -3355,7 +3354,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) /* Range check against compound member's offset */ if ((accum_change < 0) && ((ssize_t) new_dt->shared->u.compnd.memb[i].offset < accum_change)) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype") /* Apply the accumulated size change to the offset of the field */ new_dt->shared->u.compnd.memb[i].offset += (size_t) accum_change; @@ -3370,7 +3369,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) /* check if we couldn't find a match */ if(old_match < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "fields in datatype corrupted"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "fields in datatype corrupted") } /* end if */ else old_match = (int) i; @@ -3386,7 +3385,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) /* Range check against datatype size */ if ((accum_change < 0) && ((ssize_t) new_dt->shared->size < accum_change)) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype") /* Apply the accumulated size change to the size of the compound struct */ new_dt->shared->size += (size_t) accum_change; @@ -3404,7 +3403,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) new_dt->shared->u.enumer.value = (uint8_t *)H5MM_malloc(new_dt->shared->u.enumer.nalloc * new_dt->shared->size); if(NULL == new_dt->shared->u.enumer.value) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDmemcpy(new_dt->shared->u.enumer.value, old_dt->shared->u.enumer.value, new_dt->shared->u.enumer.nmembs * new_dt->shared->size); for(i = 0; i < new_dt->shared->u.enumer.nmembs; i++) { @@ -3418,7 +3417,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) if(method == H5T_COPY_TRANSIENT || method == H5T_COPY_REOPEN) { /* H5T_copy converts any type into a memory type */ if(H5T_set_loc(new_dt, NULL, H5T_LOC_MEMORY) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location") } /* end if */ break; @@ -3672,7 +3671,7 @@ done: * Purpose: Frees a datatype and all associated memory. * * Note: Does _not_ deal with open named datatypes, etc. so this - * should never see a type managed by a VOL driver. + * should never see a type managed by a VOL connector. * * Return: Non-negative on success/Negative on failure * @@ -3694,7 +3693,7 @@ H5T_close_real(H5T_t *dt) /* Clean up resources, depending on shared state */ if(dt->shared->state != H5T_STATE_OPEN) { if(H5T__free(dt) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free datatype") dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); } /* end if */ @@ -3788,7 +3787,7 @@ H5T_close(H5T_t *dt) /* Clean up resources */ if(H5T_close_real(dt) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to free datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to free datatype") done: FUNC_LEAVE_NOAPI(ret_value) @@ -3837,7 +3836,7 @@ H5T__set_size(H5T_t *dt, size_t size) if(dt->shared->parent) { if(H5T__set_size(dt->shared->parent, size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set size for parent data type"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set size for parent data type") /* Adjust size of datatype appropriately */ if(dt->shared->type==H5T_ARRAY) @@ -3879,7 +3878,7 @@ H5T__set_size(H5T_t *dt, size_t size) size_t max_size; if((num_membs = H5T_get_nmembers(dt)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to get number of members"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to get number of members") if(num_membs) { for(i = 0; i < (unsigned)num_membs; i++) { @@ -3893,7 +3892,7 @@ H5T__set_size(H5T_t *dt, size_t size) max_size = H5T__get_member_size(dt, max_index); if(size < (max_offset + max_size)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size shrinking will cut off last member "); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size shrinking will cut off last member ") } /* end if */ /* Compound must not have been packed previously */ @@ -3913,7 +3912,7 @@ H5T__set_size(H5T_t *dt, size_t size) /* Get a copy of unsigned char type as the base/parent type */ if(NULL == (base = (H5T_t *)H5I_object(H5T_NATIVE_UCHAR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid base datatype"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid base datatype") dt->shared->parent=H5T_copy(base,H5T_COPY_ALL); /* change this datatype into a VL string */ @@ -3939,7 +3938,7 @@ H5T__set_size(H5T_t *dt, size_t size) /* Set up VL information */ if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location") } /* end if */ else { prec = 8 * size; @@ -3955,7 +3954,7 @@ H5T__set_size(H5T_t *dt, size_t size) if(dt->shared->u.atomic.u.f.sign >= prec+offset || dt->shared->u.atomic.u.f.epos + dt->shared->u.atomic.u.f.esize > prec+offset || dt->shared->u.atomic.u.f.mpos + dt->shared->u.atomic.u.f.msize > prec+offset) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first") } break; @@ -4095,7 +4094,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) /* Build an index for each type so the names are sorted */ if(NULL == (idx1 = (unsigned *)H5MM_malloc(dt1->shared->u.compnd.nmembs * sizeof(unsigned))) || NULL == (idx2 = (unsigned *)H5MM_malloc(dt2->shared->u.compnd.nmembs * sizeof(unsigned)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed") for(u = 0; u < dt1->shared->u.compnd.nmembs; u++) idx1[u] = idx2[u] = u; if(dt1->shared->u.enumer.nmembs > 1) { @@ -4181,7 +4180,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) /* Build an index for each type so the names are sorted */ if(NULL == (idx1 = (unsigned *)H5MM_malloc(dt1->shared->u.enumer.nmembs * sizeof(unsigned))) || NULL == (idx2 = (unsigned *)H5MM_malloc(dt2->shared->u.enumer.nmembs * sizeof(unsigned)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed") for(u=0; u<dt1->shared->u.enumer.nmembs; u++) idx1[u] = u; if(dt1->shared->u.enumer.nmembs > 1) { @@ -5070,7 +5069,7 @@ done: *------------------------------------------------------------------------- */ H5G_name_t * -H5T_nameof(H5T_t *dt) +H5T_nameof(const H5T_t *dt) { H5G_name_t *ret_value = NULL; @@ -5190,21 +5189,21 @@ H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to reset path") /* If the datatype is committed through the VOL, close it */ - if (NULL != dt->vol_obj) { + if(NULL != dt->vol_obj) { H5VL_object_t *vol_obj = dt->vol_obj; /* Close the datatype through the VOL*/ - if ((ret_value = H5VL_datatype_close(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype"); + if(H5VL_datatype_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype") /* Free the datatype and set the VOL object pointer to NULL */ - if (H5VL_free_object(vol_obj) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object"); + if(H5VL_free_object(vol_obj) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object") dt->vol_obj = NULL; - } + } /* end if */ dt->shared->state = H5T_STATE_TRANSIENT; - } + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -5349,7 +5348,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* Mark the VL, compound or array type */ if((changed=H5T_set_loc(dt->shared->parent,f,loc))<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location") if(changed>0) ret_value=changed; @@ -5373,7 +5372,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* Range check against compound member's offset */ if ((accum_change < 0) && ((ssize_t) dt->shared->u.compnd.memb[i].offset < accum_change)) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype") /* Apply the accumulated size change to the offset of the field */ dt->shared->u.compnd.memb[i].offset += (size_t) accum_change; @@ -5389,7 +5388,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* Mark the VL, compound, enum or array type */ if((changed = H5T_set_loc(memb_type,f,loc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location") if(changed > 0) ret_value = changed; @@ -5398,7 +5397,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* Fail if the old_size is zero */ if (0 == old_size) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "old_size of zero would cause division by zero"); + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "old_size of zero would cause division by zero") /* Adjust the size of the member */ dt->shared->u.compnd.memb[i].size = (dt->shared->u.compnd.memb[i].size*memb_type->shared->size)/old_size; @@ -5411,7 +5410,7 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* Range check against datatype size */ if ((accum_change < 0) && ((ssize_t) dt->shared->size < accum_change)) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype"); + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype") /* Apply the accumulated size change to the datatype */ dt->shared->size += (size_t) accum_change; @@ -5423,14 +5422,14 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) /* (If the force_conv flag is _not_ set, the type cannot change in size, so don't recurse) */ if(dt->shared->parent->shared->force_conv && H5T_IS_COMPLEX(dt->shared->parent->shared->type)) { if((changed = H5T_set_loc(dt->shared->parent,f,loc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location") if(changed > 0) ret_value = changed; } /* end if */ /* Mark this VL sequence */ if((changed = H5T__vlen_set_loc(dt, f, loc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location") if(changed > 0) ret_value = changed; break; diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 09a0f3f..b02f8ce 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -150,19 +150,17 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Commit the type */ - if(NULL == (data = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->driver->cls, - name, type_id, lcpl_id, tcpl_id, tapl_id, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (data = H5VL_datatype_commit(vol_obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") /* Set up VOL object */ if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure") - new_obj->driver = vol_obj->driver; - new_obj->driver->nrefs ++; + new_obj->connector = vol_obj->connector; + new_obj->connector->nrefs ++; new_obj->data = data; - /* Set the committed type object to the VOL driver pointer in the H5T_t struct */ + /* Set the committed type object to the VOL connector pointer in the H5T_t struct */ dt->vol_obj = new_obj; done: @@ -269,7 +267,7 @@ done: herr_t H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) { - void *dt = NULL; /* datatype object created by VOL plugin */ + void *dt = NULL; /* datatype object created by VOL connector */ H5VL_object_t *new_obj = NULL; /* VOL object that holds the datatype object and the VOL info */ H5T_t *type = NULL; /* Datatype created */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ @@ -305,19 +303,17 @@ 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, "invalid file identifier") /* Commit the datatype */ - if(NULL == (dt = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->driver->cls, - NULL, type_id, H5P_DEFAULT, tcpl_id, tapl_id, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dt = H5VL_datatype_commit(vol_obj, loc_params, NULL, type_id, H5P_DEFAULT, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") /* Setup VOL object */ if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure") - new_obj->driver = vol_obj->driver; - new_obj->driver->nrefs ++; + new_obj->connector = vol_obj->connector; + new_obj->connector->nrefs ++; new_obj->data = dt; - /* Set the committed type object to the VOL pluging pointer in the H5T_t struct */ + /* Set the committed type object to the VOL connector pointer in the H5T_t struct */ type->vol_obj = new_obj; done: @@ -568,7 +564,7 @@ done: hid_t H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) { - void *dt = NULL; /* datatype token created by VOL driver */ + void *dt = NULL; /* datatype token created by VOL connector */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -595,18 +591,17 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Open the datatype */ - if(NULL == (dt = H5VL_datatype_open(vol_obj->data, loc_params, vol_obj->driver->cls, - name, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dt = H5VL_datatype_open(vol_obj, loc_params, name, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") /* Register the type and return the ID */ - if((ret_value = H5VL_register(H5I_DATATYPE, dt, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") + if((ret_value = H5VL_register(H5I_DATATYPE, dt, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: /* Cleanup on error */ if(H5I_INVALID_HID == ret_value) - if(dt && H5VL_datatype_close(dt, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dt && H5VL_datatype_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") FUNC_LEAVE_API(ret_value) @@ -658,16 +653,15 @@ H5Tget_create_plist(hid_t dtype_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't get default creation property list") if((ret_value = H5P_copy_plist(tcpl_plist, TRUE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list") - } + } /* end if */ /* If the datatype is committed, retrieve further information */ else { H5VL_object_t *vol_obj = type->vol_obj; /* Get the property list through the VOL */ - if(H5VL_datatype_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATATYPE_GET_TCPL, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) + if(H5VL_datatype_get(vol_obj, H5VL_DATATYPE_GET_TCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info") - } + } /* end else */ done: FUNC_LEAVE_API(ret_value) @@ -707,8 +701,7 @@ H5Tflush(hid_t type_id) /* Flush metadata for named datatype */ if(dt->vol_obj) - if((ret_value = H5VL_datatype_specific(dt->vol_obj->data, dt->vol_obj->driver->cls, H5VL_DATATYPE_FLUSH, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id)) < 0) + if(H5VL_datatype_specific(dt->vol_obj, H5VL_DATATYPE_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype") done: @@ -749,8 +742,7 @@ H5Trefresh(hid_t type_id) /* Refresh the datatype's metadata */ if(dt->vol_obj) - if((ret_value = H5VL_datatype_specific(dt->vol_obj->data, dt->vol_obj->driver->cls, H5VL_DATATYPE_REFRESH, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id)) < 0) + if(H5VL_datatype_specific(dt->vol_obj, H5VL_DATATYPE_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") done: @@ -1088,7 +1080,7 @@ H5T_update_shared(H5T_t *dt) /*------------------------------------------------------------------------- * Function: H5T_construct_datatype * - * Purpose: Create a Library datatype with a plugin specific datatype object + * Purpose: Create a Library datatype with a connector specific datatype object * * Return: Success: A type structure * Failure: NULL @@ -1100,14 +1092,13 @@ H5T_construct_datatype(H5VL_object_t *vol_obj) { ssize_t nalloc; void *buf = NULL; - H5T_t *dt = NULL; /* datatype token from VOL plugin */ + H5T_t *dt = NULL; /* datatype token from VOL connector */ H5T_t *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) /* get required buf size for encoding the datatype */ - if(H5VL_datatype_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATATYPE_GET_BINARY, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &nalloc, NULL, 0) < 0) + if(H5VL_datatype_get(vol_obj, H5VL_DATATYPE_GET_BINARY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &nalloc, NULL, 0) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get datatype serialized size") /* allocate buffer to store binary description of the datatype */ @@ -1115,8 +1106,7 @@ H5T_construct_datatype(H5VL_object_t *vol_obj) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for datatype") /* get binary description of the datatype */ - if(H5VL_datatype_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATATYPE_GET_BINARY, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &nalloc, buf, (size_t)nalloc) < 0) + if(H5VL_datatype_get(vol_obj, H5VL_DATATYPE_GET_BINARY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &nalloc, buf, (size_t)nalloc) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get serialized datatype") if(NULL == (dt = H5T_decode((size_t)nalloc, (const unsigned char *)buf))) @@ -1161,7 +1151,7 @@ H5T_get_named_type(const H5T_t *dt) /*------------------------------------------------------------------------- * Function: H5T_get_actual_type * - * Purpose: Returns underlying native datatype created by native driver + * Purpose: Returns underlying native datatype created by native connector * if datatype is committed, otherwise return the datatype * object associate with the ID. * @@ -1181,7 +1171,7 @@ H5T_get_actual_type(H5T_t *dt) if(NULL == dt->vol_obj) ret_value = dt; else - ret_value = (H5T_t *)dt->vol_obj->data; + ret_value = (H5T_t *)H5VL_object_data(dt->vol_obj); FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_get_actual_type() */ @@ -1268,3 +1258,24 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_restore_refresh_state() */ + +/*------------------------------------------------------------------------- + * Function: H5T_already_vol_managed + * + * Purpose: Check if the committed datatype is already VOL managed + * + * Return: TRUE / FALSE + * + *------------------------------------------------------------------------- + */ +hbool_t +H5T_already_vol_managed(const H5T_t *dt) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(dt); + + FUNC_LEAVE_NOAPI( dt->vol_obj != NULL ) +} /* end H5T_already_vol_managed() */ + diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 0e45587..3385794 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -43,7 +43,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Ppublic.h" /* Property Lists */ #include "H5Tpkg.h" /* Datatypes */ -#include "H5VLprivate.h" /* VOL plugins */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /****************/ @@ -137,20 +137,17 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Commit the datatype */ - if(NULL == (data = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->driver->cls, - name, type_id, H5P_LINK_CREATE_DEFAULT, - H5P_DATATYPE_CREATE_DEFAULT, H5P_DATATYPE_ACCESS_DEFAULT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (data = H5VL_datatype_commit(vol_obj, loc_params, name, type_id, H5P_LINK_CREATE_DEFAULT, H5P_DATATYPE_CREATE_DEFAULT, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") /* Set up VOL object */ if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure") - new_obj->driver = vol_obj->driver; - new_obj->driver->nrefs ++; + new_obj->connector = vol_obj->connector; + new_obj->connector->nrefs ++; new_obj->data = data; - /* Set the committed type object to the VOL pluging pointer in the H5T_t struct */ + /* Set the committed type object to the VOL connectorg pointer in the H5T_t struct */ dt->vol_obj = new_obj; done: @@ -177,7 +174,7 @@ done: hid_t H5Topen1(hid_t loc_id, const char *name) { - void *dt = NULL; /* Datatype token created by VOL plugin */ + void *dt = NULL; /* Datatype token created by VOL connector */ H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -197,19 +194,17 @@ H5Topen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the datatype */ - if(NULL == (dt = H5VL_datatype_open(vol_obj->data, loc_params, vol_obj->driver->cls, - name, H5P_DATATYPE_ACCESS_DEFAULT, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (dt = H5VL_datatype_open(vol_obj, loc_params, name, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") /* Register the type and return the ID */ - if((ret_value = H5VL_register(H5I_DATATYPE, dt, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") + if((ret_value = H5VL_register(H5I_DATATYPE, dt, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: /* Cleanup on error */ if(H5I_INVALID_HID == ret_value) - if(dt && H5VL_datatype_close(dt, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dt && H5VL_datatype_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to close datatype") FUNC_LEAVE_API(ret_value) diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index c0a6d8d..6b6446f 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -119,7 +119,7 @@ H5_DLL herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc); H5_DLL H5T_t *H5T_decode(size_t buf_size, const unsigned char *buf); H5_DLL herr_t H5T_debug(const H5T_t *dt, FILE * stream); H5_DLL struct H5O_loc_t *H5T_oloc(H5T_t *dt); -H5_DLL H5G_name_t *H5T_nameof(H5T_t *dt); +H5_DLL H5G_name_t *H5T_nameof(const H5T_t *dt); H5_DLL htri_t H5T_is_immutable(const H5T_t *dt); H5_DLL htri_t H5T_is_named(const H5T_t *dt); H5_DLL herr_t H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f); @@ -144,6 +144,7 @@ H5_DLL H5VL_object_t *H5T_get_named_type(const H5T_t *dt); H5_DLL H5T_t *H5T_get_actual_type(H5T_t *dt); H5_DLL herr_t H5T_save_refresh_state(hid_t tid, struct H5O_shared_t *cached_H5O_shared); H5_DLL herr_t H5T_restore_refresh_state(hid_t tid, struct H5O_shared_t *cached_H5O_shared); +H5_DLL hbool_t H5T_already_vol_managed(const H5T_t *dt); /* Reference specific functions */ H5_DLL H5R_type_t H5T_get_ref_type(const H5T_t *dt); diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 467847f..841637d 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -531,7 +531,7 @@ H5T_vlen_str_mem_getlen(const void *_vl) #ifdef H5_NO_ALIGNMENT_RESTRICTIONS const char *s=*(const char * const *)_vl; /* Pointer to the user's string information */ #else - const char *s; /* Pointer to the user's string information */ + const char *s = NULL; /* Pointer to the user's string information */ #endif FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -566,7 +566,7 @@ H5T_vlen_str_mem_getptr(void *_vl) #ifdef H5_NO_ALIGNMENT_RESTRICTIONS char *s=*(char **)_vl; /* Pointer to the user's string information */ #else - char *s; /* Pointer to the user's string information */ + char *s = NULL; /* Pointer to the user's string information */ #endif FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -601,7 +601,7 @@ H5T_vlen_str_mem_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl) #ifdef H5_NO_ALIGNMENT_RESTRICTIONS char *s=*(char **)_vl; /* Pointer to the user's string information */ #else - char *s; /* Pointer to the user's string information */ + char *s = NULL; /* Pointer to the user's string information */ #endif FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -45,21 +45,21 @@ /* Local Typedefs */ /******************/ -/* Information needed for iterating over the registered VOL driver hid_t IDs. - * The name of the new VOL driver that is being registered is stored in the +/* Information needed for iterating over the registered VOL connector hid_t IDs. + * The name of the new VOL connector that is being registered is stored in the * name field and the found_id field is initialized to H5I_INVALID_HID (-1). - * If we find a VOL driver with the same name, we set the found_id field to + * If we find a VOL connector with the same name, we set the found_id field to * the existing ID for return to the function. */ typedef struct { - const char *name; /* The name of the VOL driver to check */ + const char *name; /* The name of the VOL connector to check */ hid_t found_id; /* The library ID if we found a match */ -} H5VL_get_driver_ud_t; +} H5VL_get_connector_ud_t; /********************/ /* Local Prototypes */ /********************/ -static int H5VL__get_driver_cb(void *obj, hid_t id, void *_op_data); +static int H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data); /*********************/ /* Package Variables */ @@ -75,7 +75,7 @@ static int H5VL__get_driver_cb(void *obj, hid_t id, void *_op_data); /*------------------------------------------------------------------------- - * Function: H5VL__get_driver_cb + * Function: H5VL__get_connector_cb * * Purpose: Callback routine to search through registered VOLs * @@ -87,9 +87,9 @@ static int H5VL__get_driver_cb(void *obj, hid_t id, void *_op_data); *------------------------------------------------------------------------- */ static int -H5VL__get_driver_cb(void *obj, hid_t id, void *_op_data) +H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data) { - H5VL_get_driver_ud_t *op_data = (H5VL_get_driver_ud_t *)_op_data; /* User data for callback */ + H5VL_get_connector_ud_t *op_data = (H5VL_get_connector_ud_t *)_op_data; /* User data for callback */ H5VL_class_t *cls = (H5VL_class_t *)obj; int ret_value = H5_ITER_CONT; /* Callback return value */ @@ -98,116 +98,20 @@ H5VL__get_driver_cb(void *obj, hid_t id, void *_op_data) if (0 == HDstrcmp(cls->name, op_data->name)) { op_data->found_id = id; ret_value = H5_ITER_STOP; - } + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL__get_driver_cb() */ +} /* end H5VL__get_connector_cb() */ /*------------------------------------------------------------------------- - * Function: H5VLinitialize + * Function: H5VLregister_connector * - * Purpose: Calls the driver-specific callback to initialize the driver. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLinitialize(hid_t driver_id, hid_t vipl_id) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ii", driver_id, vipl_id); - - /* Check args */ - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if (cls->initialize && cls->initialize(vipl_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL driver did not initialize") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLinitialize() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLterminate - * - * Purpose: Calls the driver-specific callback to terminate the driver. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLterminate(hid_t driver_id, hid_t vtpl_id) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ii", driver_id, vtpl_id); - - /* Check args */ - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if (cls->terminate && cls->terminate(vtpl_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL driver did not terminate cleanly") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLterminate() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLclose - * - * Purpose: Closes the specified VOL driver. The VOL ID will no longer - * be valid for accessing the VOL. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -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)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if(H5I_dec_app_ref(vol_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close VOL driver ID") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLclose() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLregister_driver - * - * Purpose: Registers a new VOL driver as a member of the virtual object + * Purpose: Registers a new VOL connector as a member of the virtual object * layer class. * - * Return: Success: A VOL driver ID which is good until the - * library is closed or the driver is + * Return: Success: A VOL connector ID which is good until the + * library is closed or the connector is * unregistered. * * Failure: H5I_INVALID_HID @@ -215,53 +119,58 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VLregister_driver(const H5VL_class_t *cls) +H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id) { - H5VL_get_driver_ud_t op_data; + H5VL_get_connector_ud_t op_data; /* Callback info for connector search */ hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(H5I_INVALID_HID) - H5TRACE1("i", "*x", cls); + H5TRACE2("i", "*xi", cls, vipl_id); /* Check arguments */ if (!cls) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "VOL driver class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "VOL connector class pointer cannot be NULL") if (!cls->name) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL driver class name cannot be the NULL pointer"); - /* XXX: Should probably come up with a max length so we can use strnlen()? */ + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector class name cannot be the NULL pointer") if (0 == HDstrlen(cls->name)) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL driver class name cannot be the empty string"); + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector class name cannot be the empty string") + if (cls->info_copy && !cls->info_free) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for VOL info objects when a copy callback is provided") + if (cls->get_wrap_ctx && !cls->free_wrap_ctx) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for object wrapping contexts when a get callback is provided") op_data.found_id = H5I_INVALID_HID; op_data.name = cls->name; - /* check if driver is already registered */ - if (H5I_iterate(H5I_VOL, H5VL__get_driver_cb, &op_data, TRUE) < 0) + /* check if connector is already registered */ + if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL IDs") - /* XXX: Does this need to be an error? Users probably don't care as long - * as their VOL driver is available. - */ - if (op_data.found_id != H5I_INVALID_HID) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL driver with the same name is already registered.") - - /* Create the new class ID */ - if ((ret_value = H5VL_register_driver(cls, sizeof(H5VL_class_t), TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL driver") + /* Increment the ref count on the existing VOL connector ID, if it's already registered */ + if(op_data.found_id != H5I_INVALID_HID) { + if (H5I_inc_ref(op_data.found_id, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") + ret_value = op_data.found_id; + } /* end if */ + else { + /* Create a new class ID */ + if ((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector") + } /* end else */ done: FUNC_LEAVE_API(ret_value) -} /* end H5VLregister_driver() */ +} /* end H5VLregister_connector() */ /*------------------------------------------------------------------------- - * Function: H5VLregister_driver_by_name + * Function: H5VLregister_connector_by_name * - * Purpose: Registers a new VOL driver as a member of the virtual object + * Purpose: Registers a new VOL connector as a member of the virtual object * layer class. * - * Return: Success: A VOL driver ID which is good until the - * library is closed or the driver is + * Return: Success: A VOL connector ID which is good until the + * library is closed or the connector is * unregistered. * * Failure: H5I_INVALID_HID @@ -269,90 +178,54 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VLregister_driver_by_name(const char *name) +H5VLregister_connector_by_name(const char *name, hid_t vipl_id) { - H5VL_get_driver_ud_t op_data; - hid_t ret_value = H5I_INVALID_HID; + H5VL_get_connector_ud_t op_data; /* Callback info for connector search */ + hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(H5I_INVALID_HID) - H5TRACE1("i", "*s", name); + H5TRACE2("i", "*si", name, vipl_id); /* Check arguments */ if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null VOL driver name is disallowed") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null VOL connector name is disallowed") if (0 == HDstrlen(name)) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL driver name is disallowed") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL connector name is disallowed") op_data.found_id = H5I_INVALID_HID; op_data.name = name; - /* Check if driver is already registered */ - if (H5I_iterate(H5I_VOL, H5VL__get_driver_cb, &op_data, TRUE) < 0) + /* Check if connector is already registered */ + if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids") + /* If connector alread registered, increment ref count on ID and return ID */ if (op_data.found_id != H5I_INVALID_HID) { - /* If driver alread registered, increment ref count on ID and return ID */ if (H5I_inc_ref(op_data.found_id, TRUE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver") + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") ret_value = op_data.found_id; - } + } /* end if */ else { H5PL_key_t key; const H5VL_class_t *cls; - /* Try loading the driver */ + /* Try loading the connector */ key.name = name; if (NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, key))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL driver") + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector") - /* Register the driver we loaded */ - if ((ret_value = H5VL_register_driver(cls, sizeof(H5VL_class_t), TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL driver ID") - } + /* Register the connector we loaded */ + if ((ret_value = H5VL_register_connector(cls, TRUE, vipl_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID") + } /* end else */ done: FUNC_LEAVE_API(ret_value) -} /* end H5VLregister_driver_by_name() */ +} /* end H5VLregister_connector_by_name() */ /*------------------------------------------------------------------------- - * Function: H5VLunregister_driver - * - * Purpose: Removes a VOL driver ID from the library. This in no way affects - * file access property lists which have been defined to use - * this VOL driver or files which are already opened under with - * this driver. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLunregister_driver(hid_t vol_id) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE1("e", "i", vol_id); - - /* Check arguments */ - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(vol_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a vol driver") - - /* The H5VL_class_t struct will be freed by this function */ - if (H5I_dec_app_ref(vol_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister vol driver") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLunregister_driver() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLis_driver_registered + * Function: H5VLis_connector_registered * * Purpose: Tests whether a VOL class has been registered or not * @@ -365,10 +238,10 @@ done: *------------------------------------------------------------------------- */ htri_t -H5VLis_driver_registered(const char *name) +H5VLis_connector_registered(const char *name) { - H5VL_get_driver_ud_t op_data; - htri_t ret_value = FALSE; /* Return value */ + H5VL_get_connector_ud_t op_data; /* Callback info for connector search */ + htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("t", "*s", name); @@ -377,7 +250,7 @@ H5VLis_driver_registered(const char *name) op_data.name = name; /* Check arguments */ - if (H5I_iterate(H5I_VOL, H5VL__get_driver_cb, &op_data, TRUE) < 0) + if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) HGOTO_ERROR(H5E_VOL, H5E_BADITER, FAIL, "can't iterate over VOL ids") if (op_data.found_id != H5I_INVALID_HID) @@ -385,13 +258,13 @@ H5VLis_driver_registered(const char *name) done: FUNC_LEAVE_API(ret_value) -} /* end H5VLis_driver_registered() */ +} /* end H5VLis_connector_registered() */ /*------------------------------------------------------------------------- - * Function: H5VLget_driver_id + * Function: H5VLget_connector_id * - * Purpose: Retrieves the ID for a registered VOL driver. + * Purpose: Retrieves the ID for a registered VOL connector. * * Return: Positive if the VOL class has been registered * Negative on error (if the class is not a valid class or not registered) @@ -399,10 +272,10 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VLget_driver_id(const char *name) +H5VLget_connector_id(const char *name) { - H5VL_get_driver_ud_t op_data; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5VL_get_connector_ud_t op_data; /* Callback info for connector search */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "*s", name); @@ -411,1835 +284,89 @@ H5VLget_driver_id(const char *name) op_data.name = name; /* Check arguments */ - if (H5I_iterate(H5I_VOL, H5VL__get_driver_cb, &op_data, TRUE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL driver IDs") + if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL connector IDs") if (op_data.found_id != H5I_INVALID_HID) { if (H5I_inc_ref(op_data.found_id, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver") - + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") ret_value = op_data.found_id; - } + } /* end if */ done: FUNC_LEAVE_API(ret_value) -} /* end H5VLget_driver_id() */ +} /* end H5VLget_connector_id() */ /*------------------------------------------------------------------------- - * Function: H5VLget_driver_name + * Function: H5VLget_connector_name * - * Purpose: Returns the driver name for the VOL associated with the + * Purpose: Returns the connector name for the VOL associated with the * object or file ID * - * Return: Success: The length of the driver name + * Return: Success: The length of the connector name * * Failure: Negative * *------------------------------------------------------------------------- */ ssize_t -H5VLget_driver_name(hid_t obj_id, char *name/*out*/, size_t size) +H5VLget_connector_name(hid_t obj_id, char *name/*out*/, size_t size) { ssize_t ret_value = -1; FUNC_ENTER_API(FAIL) H5TRACE3("Zs", "ixz", obj_id, name, size); - if ((ret_value = H5VL_get_driver_name(obj_id, name, size)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Can't get driver name") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLget_driver_name() */ - - -/*--------------------------------------------------------------------------- - * Function: H5VLregister - * - * Purpose: Public routine to register an object and get an ID given a - * VOL driver ID. - * - * Unlike H5Iregister(), this API call can register library - * types (e.g.; H5I_DATASET). - * - * NOTE: This API call is mainly intended for VOL driver authors. - * - * Return: Success: A valid HDF5 ID - * - * Failure: H5I_INVALID_HID - * - *--------------------------------------------------------------------------- - */ -hid_t -H5VLregister(H5I_type_t type, const void *obj, hid_t driver_id) -{ - hid_t ret_value = H5I_INVALID_HID; - - FUNC_ENTER_API(H5I_INVALID_HID) - H5TRACE3("i", "It*xi", type, obj, driver_id); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "obj pointer can't be NULL") - - if ((ret_value = H5VL_register_using_vol_id(type, obj, driver_id, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object") - -done: - FUNC_LEAVE_API(ret_value) -} /* H5VLregister */ - - -/*------------------------------------------------------------------------- - * Function: H5VLobject - * - * Purpose: Public utility function to return the VOL object pointer - * associated with an hid_t. - * - * Return: Success: object pointer - * Failure: NULL - * - * Programmer: Jordan Henderson - * January, 2018 - * - *------------------------------------------------------------------------- - */ -void * -H5VLobject(hid_t id) -{ - void *ret_value = NULL; - - FUNC_ENTER_API(NULL) - H5TRACE1("*x", "i", id); - - if (NULL == (ret_value = H5VL_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLobject() */ - - -/*--------------------------------------------------------------------------- - * Function: H5VLget_object - * - * Purpose: Retrieves the object pointer associated with the ID. This - * also optionally returns the H5VL_t struct that this ID - * belongs to, if the user passes a valid pointer value. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *--------------------------------------------------------------------------- - */ -herr_t -H5VLget_object(hid_t obj_id, void **obj) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i**x", obj_id, obj); - - /* Check args */ - if (!obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object pointer") - - if (NULL == (*obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain a valid object") - -done: - FUNC_LEAVE_API(ret_value) -} /* H5VLget_object */ - - -/*------------------------------------------------------------------------- - * Function: H5VLattr_create - * - * Purpose: Creates an attribute - * - * Return: Success: Pointer to the new attribute - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, - hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_API(NULL) - H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, driver_id, name, acpl_id, - aapl_id, dxpl_id, req); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") - - if(NULL == (ret_value = H5VL_attr_create(obj, loc_params, cls, name, - acpl_id, aapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create attribute") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLattr_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLattr_open - * - * Purpose: Opens an attribute - * - * Return: Success: Pointer to the new attribute - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, - hid_t aapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_API(NULL) - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, driver_id, name, aapl_id, - dxpl_id, req); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") - - if(NULL == (ret_value = H5VL_attr_open(obj, loc_params, cls, name, aapl_id, - dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open attribute") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLattr_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLattr_read - * - * Purpose: Reads data from an attribute - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t H5VLattr_read(void *attr, hid_t driver_id, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - - if (NULL == attr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if((ret_value = H5VL_attr_read(attr, cls, mem_type_id, buf, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read attribute") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLattr_read() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLattr_write - * - * Purpose: Writes data to an attribute - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t H5VLattr_write(void *attr, hid_t driver_id, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - - if (NULL == attr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if((ret_value = H5VL_attr_write(attr, cls, mem_type_id, buf, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write attribute") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLattr_write() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLattr_get - * - * Purpose: Gets information about the attribute - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLattr_get(void *obj, hid_t driver_id, H5VL_attr_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVai**xx", obj, driver_id, get_type, dxpl_id, req, arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - /* Bypass the H5VLint layer */ - if(NULL == cls->attr_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `attr get' method") - if((ret_value = (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: - FUNC_LEAVE_API(ret_value) -} /* end H5VLattr_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLattr_specific - * - * Purpose: Performs a driver-specific operation on an attribute - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, - H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xxiVbi**xx", obj, loc_params, driver_id, specific_type, - dxpl_id, req, arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - /* Bypass the H5VLint layer */ - if(NULL == cls->attr_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `attr specific' method") - if((ret_value = (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") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLattr_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLattr_optional - * - * Purpose: Performs an optional driver-specific operation on an attribute - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLattr_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - /* Have to bypass the H5VLint layer due to unknown val_list arguments */ - if(NULL == cls->attr_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `attr optional' method") - if((ret_value = (cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLattr_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLattr_close - * - * Purpose: Closes an attribute - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLattr_close(void *attr, hid_t driver_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*xii**x", attr, driver_id, dxpl_id, req); - - if (NULL == attr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if((ret_value = H5VL_attr_close(attr, cls, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close attribute") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLattr_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdataset_create - * - * Purpose: Creates a dataset - * - * Return: Success: Pointer to the new dataset - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, - hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_API(NULL) - H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, driver_id, name, dcpl_id, - dapl_id, dxpl_id, req); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") - - if(NULL == (ret_value = H5VL_dataset_create(obj, loc_params, cls, name, - dcpl_id, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create dataset") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLdataset_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdataset_open - * - * Purpose: Opens a dataset - * - * Return: Success: Pointer to the new dataset - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, - hid_t dapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; - - FUNC_ENTER_API(NULL) - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, driver_id, name, dapl_id, - dxpl_id, req); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") - - if(NULL == (ret_value = H5VL_dataset_open(obj, loc_params, cls, name, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open dataset") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLdataset_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdataset_read - * - * Purpose: Reads data from a dataset - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdataset_read(void *dset, hid_t driver_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 *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE8("e", "*xiiiii*x**x", dset, driver_id, mem_type_id, mem_space_id, - file_space_id, plist_id, buf, req); - - if (NULL == dset) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if((ret_value = H5VL_dataset_read(dset, 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") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLdataset_read() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdataset_write - * - * Purpose: Writes data to a dataset - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdataset_write(void *dset, hid_t driver_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 *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE8("e", "*xiiiii*x**x", dset, driver_id, mem_type_id, mem_space_id, - file_space_id, plist_id, buf, req); - - if (NULL == dset) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if((ret_value = H5VL_dataset_write(dset, 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") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLdataset_write() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdataset_get - * - * Purpose: Gets information about a dataset - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdataset_get(void *dset, hid_t driver_id, H5VL_dataset_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVci**xx", dset, driver_id, get_type, dxpl_id, req, arguments); - - if (NULL == dset) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - /* Bypass the H5VLint layer */ - if(NULL == cls->dataset_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `dataset get' method") - if((ret_value = (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: - FUNC_LEAVE_API(ret_value) -} /* end H5VLdataset_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdataset_specific - * - * Purpose: Performs a driver-specific operation on a dataset - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdataset_specific(void *obj, hid_t driver_id, H5VL_dataset_specific_t specific_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVdi**xx", obj, driver_id, specific_type, dxpl_id, req, - arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if(NULL == cls->dataset_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `dataset specific' method") - if((ret_value = (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") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLdataset_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdataset_optional - * - * Purpose: Performs an optional driver-specific operation on a dataset - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdataset_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if(NULL == cls->dataset_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `dataset optional' method") - if((ret_value = (cls->dataset_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLdataset_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdataset_close - * - * Purpose: Closes a dataset - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdataset_close(void *dset, hid_t driver_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*xii**x", dset, driver_id, dxpl_id, req); - - if (NULL == dset) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if((ret_value = H5VL_dataset_close(dset, cls, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close dataset") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLdataset_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLfile_create - * - * Purpose: Creates a file - * - * Return: Success: Pointer to the new file - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLfile_create(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 */ - H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; - - FUNC_ENTER_API(NULL) - H5TRACE6("*x", "*sIuiii**x", 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_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol driver info") - - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") - - if(NULL == (ret_value = H5VL_file_create(cls, name, flags, fcpl_id, fapl_id, - dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create file") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLfile_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLfile_open - * - * Purpose: Opens a file - * - * Return: Success: Pointer to the new file - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req) -{ - H5P_genplist_t *plist; /* Property list pointer */ - H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; - - FUNC_ENTER_API(NULL) - H5TRACE5("*x", "*sIuii**x", 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_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol driver info") - - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") - - if(NULL == (ret_value = H5VL_file_open(cls, name, flags, fapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create file") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLfile_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLfile_get - * - * Purpose: Gets information about the file - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLfile_get(void *file, hid_t driver_id, H5VL_file_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVgi**xx", file, driver_id, get_type, dxpl_id, req, arguments); - - if(NULL == file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - /* Bypass the H5VLint layer */ - if(NULL == cls->file_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `file get' method") - if((ret_value = (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: - FUNC_LEAVE_API(ret_value) -} /* end H5VLfile_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLfile_specific - * - * Purpose: Performs a driver-specific operation on a file - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLfile_specific(void *file, hid_t driver_id, H5VL_file_specific_t specific_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVhi**xx", file, driver_id, specific_type, dxpl_id, req, - arguments); - - if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { - H5P_genplist_t *plist; /* Property list pointer */ - H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ - hid_t fapl_id; - - fapl_id = va_arg (arguments, hid_t); - - /* 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_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol driver info") - - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if((ret_value = (cls->file_cls.specific) - (file, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") - } - else { - if(NULL == file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if(NULL == cls->file_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `file specific' method") - if((ret_value = (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") - } - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLfile_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLfile_optional - * - * Purpose: Performs an optional driver-specific operation on a file - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLfile_optional(void *file, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", file, driver_id, dxpl_id, req, arguments); - - if(NULL == file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if(NULL == cls->file_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `file optional' method") - if((ret_value = (cls->file_cls.optional)(file, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file optional callback") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLfile_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLfile_close - * - * Purpose: Closes a file - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLfile_close(void *file, hid_t driver_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*xii**x", file, driver_id, dxpl_id, req); - - if(NULL == file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if((ret_value = H5VL_file_close(file, cls, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close file") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLfile_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLgroup_create - * - * Purpose: Creates a group - * - * Return: Success: Pointer to the new group - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, - hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; - - FUNC_ENTER_API(NULL) - H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, driver_id, name, gcpl_id, - gapl_id, dxpl_id, req); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") - - if(NULL == (ret_value = H5VL_group_create(obj, loc_params, cls, name, - gcpl_id, gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create group") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLgroup_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLgroup_open - * - * Purpose: Opens a group - * - * Return: Success: Pointer to the new group - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, - hid_t gapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; - - FUNC_ENTER_API(NULL) - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, driver_id, name, gapl_id, - dxpl_id, req); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") - - if(NULL == (ret_value = H5VL_group_open(obj, loc_params, cls, name, - gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLgroup_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLgroup_get - * - * Purpose: Gets information about the group - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLgroup_get(void *obj, hid_t driver_id, H5VL_group_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVii**xx", obj, driver_id, get_type, dxpl_id, req, arguments); - - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - /* Bypass the H5VLint layer */ - if(NULL == cls->group_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `group get' method") - if((ret_value = (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: - FUNC_LEAVE_API(ret_value) -} /* end H5VLgroup_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLgroup_specific - * - * Purpose: Performs a driver-specific operation on a group - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLgroup_specific(void *obj, hid_t driver_id, H5VL_group_specific_t specific_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVji**xx", obj, driver_id, specific_type, dxpl_id, req, - arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if(NULL == cls->group_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `group specific' method") - if((ret_value = (cls->group_cls.specific) - (obj, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLgroup_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLgroup_optional - * - * Purpose: Performs an optional driver-specific operation on a group - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLgroup_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if(NULL == cls->group_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `group optional' method") - if((ret_value = (cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLgroup_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLgroup_close - * - * Purpose: Closes a group - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLgroup_close(void *grp, hid_t driver_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*xii**x", grp, driver_id, dxpl_id, req); - - if(NULL == grp) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if((ret_value = H5VL_group_close(grp, cls, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close group") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLgroup_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLlink_create - * - * Purpose: Creates a hard link - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, - hid_t driver_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE8("e", "Vk*xxiiii**x", create_type, obj, loc_params, driver_id, lcpl_id, - lapl_id, dxpl_id, req); - - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if((ret_value = H5VL_link_create(create_type, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to create link") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLlink_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLlink_copy - * - * Purpose: Copies a link to a new location - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, hid_t driver_id, - hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2, - driver_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 == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if((ret_value = H5VL_link_copy(src_obj, loc_params1, dst_obj, loc_params2, cls, - lcpl_id, lapl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to copy object") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLlink_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLlink_move - * - * Purpose: Moves a link to another location - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, hid_t driver_id, - hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2, - driver_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 == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if((ret_value = H5VL_link_move(src_obj, loc_params1, dst_obj, loc_params2, cls, - lcpl_id, lapl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to move object") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLlink_move() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLlink_get - * - * Purpose: Gets information about a link - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_link_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xxiVli**xx", obj, loc_params, driver_id, get_type, dxpl_id, req, - arguments); - - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if(NULL == cls->link_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `link get' method") - if((ret_value = (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") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLlink_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLlink_specific - * - * Purpose: Performs a driver-specific operation on a link - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, - H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xxiVmi**xx", obj, loc_params, driver_id, specific_type, - dxpl_id, req, arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - /* Bypass the H5VLint layer */ - if(NULL == cls->link_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `link specific' method") - if((ret_value = (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") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLlink_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLlink_optional - * - * Purpose: Performs an optional driver-specific operation on a link - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLlink_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - /* Have to bypass the H5VLint layer due to unknown val_list arguments */ - if(NULL == cls->link_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `link optional' method") - if((ret_value = (cls->link_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLlink_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLobject_open - * - * Purpose: Opens an object - * - * Return: Success: Pointer to the new object - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLobject_open(void *obj, H5VL_loc_params_t params, hid_t driver_id, H5I_type_t *opened_type, - hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; - - FUNC_ENTER_API(NULL) - H5TRACE6("*x", "*xxi*Iti**x", obj, params, driver_id, opened_type, dxpl_id, req); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") - - if(NULL == (ret_value = H5VL_object_open(obj, params, cls, opened_type, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create group") + if ((ret_value = H5VL_get_connector_name(obj_id, name, size)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Can't get connector name") done: FUNC_LEAVE_API(ret_value) -} /* end H5VLobject_open() */ +} /* end H5VLget_connector_name() */ /*------------------------------------------------------------------------- - * Function: H5VLobject_copy - * - * Purpose: Copies an object to another location - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, hid_t driver_id1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, hid_t driver_id2, const char *dst_name, - hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls1 = NULL; - H5VL_class_t *cls2 = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE12("e", "*xxi*s*xxi*siii**x", src_obj, loc_params1, driver_id1, - src_name, dst_obj, loc_params2, driver_id2, dst_name, ocpypl_id, - lcpl_id, dxpl_id, req); - - if(NULL == src_obj || NULL == dst_obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(driver_id1, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - if(NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(driver_id2, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if((ret_value = H5VL_object_copy(src_obj, loc_params1, cls1, src_name, - dst_obj, loc_params2, cls2, dst_name, - ocpypl_id, lcpl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to move object") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLobject_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLobject_get - * - * Purpose: Gets information about an object - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_object_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xxiVni**xx", obj, loc_params, driver_id, get_type, dxpl_id, req, - arguments); - - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if(NULL == cls->object_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `object get' method") - if((ret_value = (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") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLobject_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLobject_specific - * - * Purpose: Performs a driver-specific operation on an object - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, - H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xxiVoi**xx", obj, loc_params, driver_id, specific_type, - dxpl_id, req, arguments); - - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - /* Bypass the H5VLint layer */ - if(NULL == cls->object_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `object specific' method") - if((ret_value = (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") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLobject_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLobject_optional - * - * Purpose: Performs an optional driver-specific operation on an object - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLobject_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - /* Have to bypass the H5VLint layer due to unknown val_list arguments */ - if(NULL == cls->object_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `object optional' method") - if((ret_value = (cls->object_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLobject_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdatatype_commit - * - * Purpose: Commits a datatype to the file - * - * Return: Success: Pointer to the new datatype - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t driver_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) -{ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; - - FUNC_ENTER_API(NULL) - H5TRACE10("*x", "*xxi*siiiii**x", obj, loc_params, driver_id, name, type_id, - lcpl_id, tcpl_id, tapl_id, dxpl_id, req); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") - - if(NULL == (ret_value = H5VL_datatype_commit(obj, loc_params, cls, name, type_id, - lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to commit datatype") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLdatatype_commit() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdatatype_open - * - * Purpose: Opens a named datatype - * - * Return: Success: Pointer to the new datatype - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, - hid_t tapl_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - void *ret_value = NULL; - - FUNC_ENTER_API(NULL) - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, driver_id, name, tapl_id, - dxpl_id, req); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") - - if(NULL == (ret_value = H5VL_datatype_open(obj, loc_params, cls, name, - tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open datatype") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLdatatype_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdatatype_specific - * - * Purpose: Performs a driver-specific operation on a datatype - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdatatype_specific(void *obj, hid_t driver_id, H5VL_datatype_specific_t specific_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVfi**xx", obj, driver_id, specific_type, dxpl_id, req, - arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if(NULL == cls->datatype_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `datatype specific' method") - if((ret_value = (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") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLdatatype_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdatatype_optional - * - * Purpose: Performs an optional driver-specific operation on a datatype - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdatatype_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); - - if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if(NULL == cls->datatype_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `datatype optional' method") - if((ret_value = (cls->datatype_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLdatatype_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdatatype_get - * - * Purpose: Gets information about the datatype - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdatatype_get(void *obj, hid_t driver_id, H5VL_datatype_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVei**xx", obj, driver_id, get_type, dxpl_id, req, arguments); - - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - /* Bypass the H5VLint layer */ - if(NULL == cls->datatype_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `datatype get' method") - if((ret_value = (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: - FUNC_LEAVE_API(ret_value) -} /* end H5VLdatatype_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLdatatype_close - * - * Purpose: Closes a datatype - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLdatatype_close(void *dt, hid_t driver_id, hid_t dxpl_id, void **req) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*xii**x", dt, driver_id, dxpl_id, req); - - if (NULL == dt) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if((ret_value = H5VL_datatype_close(dt, cls, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close datatype") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLdatatype_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLrequest_cancel + * Function: H5VLclose * - * Purpose: Cancels a request + * Purpose: Closes a VOL connector ID. This in no way affects + * file access property lists which have been defined to use + * this VOL connector or files which are already opened under with + * this connector. * * Return: Success: Non-negative - * * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5VLrequest_cancel(void **req, hid_t driver_id, H5ES_status_t *status) +H5VLclose(hid_t vol_id) { - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "**xi*Es", req, driver_id, status); + H5TRACE1("e", "i", vol_id); - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + /* Check args */ + if(NULL == H5I_object_verify(vol_id, H5I_VOL)) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector") - if ((ret_value = H5VL_request_cancel(req, cls, status)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to cancel request") + /* Decrement the ref count on the ID, possibly releasing the VOL connector */ + if(H5I_dec_app_ref(vol_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to close VOL connector ID") done: FUNC_LEAVE_API(ret_value) -} /* end H5VLrequest_cancel() */ +} /* end H5VLclose() */ /*------------------------------------------------------------------------- - * Function: H5VLrequest_test + * Function: H5VLunregister_connector * - * Purpose: Tests a request + * Purpose: Removes a VOL connector ID from the library. This in no way affects + * file access property lists which have been defined to use + * this VOL connector or files which are already opened under with + * this connector. * * Return: Success: Non-negative * @@ -2248,54 +375,59 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_test(void **req, hid_t driver_id, H5ES_status_t *status) +H5VLunregister_connector(hid_t vol_id) { - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "**xi*Es", req, driver_id, status); + H5TRACE1("e", "i", vol_id); - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + /* Check arguments */ + if(NULL == H5I_object_verify(vol_id, H5I_VOL)) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector") - if ((ret_value = H5VL_request_test(req, cls, status)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to test request") + /* The H5VL_class_t struct will be freed by this function */ + if (H5I_dec_app_ref(vol_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister VOL connector") done: FUNC_LEAVE_API(ret_value) -} /* end H5VLrequest_test() */ +} /* end H5VLunregister_connector() */ -/*------------------------------------------------------------------------- - * Function: H5VLrequest_wait +/*--------------------------------------------------------------------------- + * Function: H5VLcmp_connector_cls * - * Purpose: Waits on a request + * Purpose: Compares two connector classes * - * Return: Success: Non-negative + * Return: Success: Non-negative, with *cmp set to positive if + * connector_id1 is greater than connector_id2, negative if connector_id2 + * is greater than connector_id1 and zero if connector_id1 and connector_id2 + * are equal. * * Failure: Negative * - *------------------------------------------------------------------------- + *--------------------------------------------------------------------------- */ herr_t -H5VLrequest_wait(void **req, hid_t driver_id, H5ES_status_t *status) +H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connector_id2) { - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; + H5VL_class_t *cls1, *cls2; /* connectors for IDs */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "**xi*Es", req, driver_id, status); + H5TRACE3("e", "*Isii", cmp, connector_id1, connector_id2); - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if ((ret_value = H5VL_request_wait(req, cls, status)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to wait on request") + /* Check args and get class pointers */ + if(NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(connector_id1, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + if(NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(connector_id2, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + /* Compare the two VOL connector classes */ + *cmp = H5VL_cmp_connector_cls(cls1, cls2); done: FUNC_LEAVE_API(ret_value) -} /* end H5VLrequest_wait() */ - +} /* H5VLcmp_connector_cls() */ diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c new file mode 100644 index 0000000..52d1296 --- /dev/null +++ b/src/H5VLcallback.c @@ -0,0 +1,6160 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: The Virtual Object Layer as described in documentation. + * The pupose is to provide an abstraction on how to access the + * underlying HDF5 container, whether in a local file with + * a specific file format, or remotely on other machines, etc... + */ + + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5VLmodule.h" /* This source code file is part of the H5VL module */ + + +/***********/ +/* Headers */ +/***********/ + +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5VLpkg.h" /* Virtual Object Layer */ + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ +static void *H5VL__attr_create(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, const char *name, hid_t acpl_id, hid_t aapl_id, + hid_t dxpl_id, void **req); +static void *H5VL__attr_open(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, const char *name, hid_t aapl_id, hid_t dxpl_id, + void **req); +static herr_t H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, + void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL__attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, + const void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__attr_specific(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, H5VL_attr_specific_t specific_type, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req); +static void *H5VL__dataset_create(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, const char *name, hid_t dcpl_id, hid_t dapl_id, + hid_t dxpl_id, void **req); +static void *H5VL__dataset_open(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, const char *name, hid_t dapl_id, hid_t dxpl_id, + void **req); +static herr_t H5VL__dataset_read(void *dset, const H5VL_class_t *cls, + hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, + void *buf, void **req); +static herr_t H5VL__dataset_write(void *obj, const H5VL_class_t *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); +static herr_t H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, + H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req); +static herr_t H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req); +static void *H5VL__group_create(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, const char *name, hid_t gcpl_id, hid_t gapl_id, + hid_t dxpl_id, void **req); +static void *H5VL__group_open(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, const char *name, hid_t gapl_id, hid_t dxpl_id, + void **req); +static herr_t H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__group_close(void *obj, const H5VL_class_t *cls, + hid_t dxpl_id, void **req); +static herr_t H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, + H5VL_loc_params_t loc_params, const H5VL_class_t *cls, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__link_copy(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__link_move(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__link_get(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, H5VL_link_get_t get_type, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__link_specific(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, H5VL_link_specific_t specific_type, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments); +static void *H5VL__object_open(void *obj, H5VL_loc_params_t params, const H5VL_class_t *cls, + H5I_type_t *opened_type, hid_t dxpl_id, void **req); +static herr_t H5VL__object_copy(void *src_obj, H5VL_loc_params_t src_loc_params, + const char *src_name, void *dst_obj, H5VL_loc_params_t dst_loc_params, + const char *dst_name, const H5VL_class_t *cls, hid_t ocpypl_id, + hid_t lcpl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__object_get(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, H5VL_object_get_t get_type, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__object_specific(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, H5VL_object_specific_t specific_type, hid_t dxpl_id, + void **req, va_list arguments); +static herr_t H5VL__object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments); +static void * H5VL__datatype_commit(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *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); +static void *H5VL__datatype_open(void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, const char *name, hid_t tapl_id, hid_t dxpl_id, + void **req); +static herr_t H5VL__datatype_get(void *obj, const H5VL_class_t *cls, + H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, + H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, + va_list arguments); +static herr_t H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, + hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req); +static herr_t H5VL__request_wait(void *req, const H5VL_class_t *cls, + uint64_t timeout, H5ES_status_t *status); +static herr_t H5VL__request_cancel(void *req, const H5VL_class_t *cls); +static herr_t H5VL__request_specific(void *req, const H5VL_class_t *cls, + H5VL_request_specific_t specific_type, va_list arguments); +static herr_t H5VL__request_optional(void *req, const H5VL_class_t *cls, + va_list arguments); +static herr_t H5VL__request_free(void *req, const H5VL_class_t *cls); + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*------------------------------------------------------------------------- + * Function: H5VLinitialize + * + * Purpose: Calls the connector-specific callback to initialize the connector. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLinitialize(hid_t connector_id, hid_t vipl_id) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "ii", connector_id, vipl_id); + + /* Check args */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Invoke class' callback, if there is one */ + if(cls->initialize && cls->initialize(vipl_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not initialize") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLinitialize() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLterminate + * + * Purpose: Calls the connector-specific callback to terminate the connector. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLterminate(hid_t connector_id) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE1("e", "i", connector_id); + + /* Check args */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Invoke class' callback, if there is one */ + if(cls->terminate && cls->terminate() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLterminate() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLget_cap_flags + * + * Purpose: Retrieves the capability flag for a connector + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLget_cap_flags(hid_t connector_id, unsigned *cap_flags) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "i*Iu", connector_id, cap_flags); + + /* Check args */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Retrieve capability flags */ + if(cap_flags) + *cap_flags = cls->cap_flags; + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLget_cap_flags */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_copy_connector_info + * + * Purpose: Copy the VOL info for a connector + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info, + const void *src_info) +{ + void *new_connector_info = NULL; /* Copy of connector info */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(connector); + + /* Check for actual source info */ + if(src_info) { + /* Allow the connector to copy or do it ourselves */ + if(connector->info_copy) { + if(NULL == (new_connector_info = (connector->info_copy)(src_info))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "connector info copy callback failed") + } /* end if */ + else if(connector->info_size > 0) { + if(NULL == (new_connector_info = H5MM_malloc(connector->info_size))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "connector info allocation failed") + HDmemcpy(new_connector_info, src_info, connector->info_size); + } /* end else-if */ + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "no way to copy connector info") + } /* end if */ + + /* Set the connector info for the copy */ + *dst_info = new_connector_info; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_copy_connector_info() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLcopy_connector_info + * + * Purpose: Copies a VOL connector's info object + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLcopy_connector_info(hid_t connector_id, void **dst_vol_info, void *src_vol_info) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE3("e", "i**x*x", connector_id, dst_vol_info, src_vol_info); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Copy the VOL connector's info object */ + if(H5VL_copy_connector_info(cls, dst_vol_info, src_vol_info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy VOL connector info object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLcopy_connector_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_cmp_connector_info + * + * Purpose: Compare VOL info for a connector + * + * Return: Positive if VALUE1 is greater than VALUE2, negative if + * VALUE2 is greater than VALUE1 and zero if VALUE1 and + * VALUE2 are equal. + * + *------------------------------------------------------------------------- + */ +int +H5VL_cmp_connector_info(const H5VL_class_t *connector, const void *info1, + const void *info2) +{ + int cmp_value; /* Value from comparison */ + int ret_value = 0; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(connector); + + /* Use the class's info comparison routine to compare the info objects, + * if there is a a callback, otherwise just compare the info objects as + * memory buffers + */ + if(connector->info_cmp) { + if(0 != (cmp_value = (connector->info_cmp)(info1, info2))) + HGOTO_DONE(cmp_value); + } /* end if */ + else { + if(info1 == NULL && info2 != NULL) + HGOTO_DONE(-1); + if(info1 != NULL && info2 == NULL) + HGOTO_DONE(1); + if(info1) { + HDassert(connector->info_size > 0); + if(0 != (cmp_value = HDmemcmp(info1, info2, connector->info_size))) + HGOTO_DONE(cmp_value); + } /* end if */ + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_cmp_connector_info() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLcmp_connector_info + * + * Purpose: Compares two connector info objects + * + * Note: Both info objects must be from the same VOL connector class + * + * Return: Success: Non-negative, with *cmp set to positive if + * info1 is greater than info2, negative if info2 + * is greater than info1 and zero if info1 and info2 + * are equal. + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLcmp_connector_info(int *cmp, hid_t connector_id, const void *info1, const void *info2) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "*Isi*x*x", cmp, connector_id, info1, info2); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Compare the two VOL connector info objects */ + if(cmp) + *cmp = H5VL_cmp_connector_info(cls, info1, info2); + +done: + FUNC_LEAVE_API(ret_value) +} /* H5VLcmp_connector_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_free_connector_info + * + * Purpose: Free VOL info for a connector + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_free_connector_info(const H5VL_class_t *connector, void *info) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(connector); + + /* Only free info object, if it's non-NULL */ + if(info) { + /* Allow the connector to free info or do it ourselves */ + if(connector->info_free) { + if((connector->info_free)(info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector info free request failed") + } /* end if */ + else + H5MM_xfree(info); + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_free_connector_info() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLfree_connector_info + * + * Purpose: Free VOL connector info object + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLfree_connector_info(hid_t connector_id, void *info) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "i*x", connector_id, info); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Free the VOL connector info object */ + if(H5VL_free_connector_info(cls, info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLfree_connector_info() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLget_object + * + * Purpose: Retrieves an underlying object. + * + * Return: Success: Non-NULL + * Failure: NULL + * + *--------------------------------------------------------------------------- + */ +void * +H5VLget_object(void *obj, hid_t connector_id) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("*x", "*xi", obj, connector_id); + + /* Check args */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Check for 'get_object' callback in connector */ + if(cls->get_object) + ret_value = (cls->get_object)(obj); + else + ret_value = obj; + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLget_object */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_get_wrap_ctx + * + * Purpose: Retrieve the VOL object wrapping context for a connector + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj, void **wrap_ctx) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(connector); + HDassert(obj); + HDassert(wrap_ctx); + + /* Allow the connector to copy or do it ourselves */ + if(connector->get_wrap_ctx) { + /* Sanity check */ + HDassert(connector->free_wrap_ctx); + + /* Invoke connector's callback */ + if((connector->get_wrap_ctx)(obj, wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "connector wrap context callback failed") + } /* end if */ + else + *wrap_ctx = NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_get_wrap_ctx() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLget_wrap_ctx + * + * Purpose: Get a VOL connector's object wrapping context + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE3("e", "*xi**x", obj, connector_id, wrap_ctx); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Get the VOL connector's object wrapper */ + if(H5VL_get_wrap_ctx(cls, obj, wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to retrieve VOL connector object wrap context") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLget_wrap_ctx() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_free_wrap_ctx + * + * Purpose: Free object wrapping context for a connector + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(connector); + + /* Only free wrap context, if it's non-NULL */ + if(wrap_ctx) { + /* Free the connector's object wrapping context */ + if((connector->free_wrap_ctx)(wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector wrap context free request failed") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_free_connector_info() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLfree_wrap_ctx + * + * Purpose: Release a VOL connector's object wrapping context + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "*xi", wrap_ctx, connector_id); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Release the VOL connector's object wrapper */ + if(H5VL_free_wrap_ctx(cls, wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector object wrap context") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLfree_wrap_ctx() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_wrap_object + * + * Purpose: Wrap an object with connector + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +void * +H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj) +{ + void *ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Sanity checks */ + HDassert(connector); + HDassert(obj); + + /* Only wrap object if there's a wrap context */ + if(wrap_ctx) { + /* Ask the connector to wrap the object */ + if(NULL == (ret_value = (connector->wrap_object)(obj, wrap_ctx))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object") + } /* end if */ + else + ret_value = obj; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_wrap_object() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLwrap_object + * + * Purpose: Asks a connector to wrap an underlying object. + * + * Return: Success: Non-NULL + * Failure: NULL + * + *--------------------------------------------------------------------------- + */ +void * +H5VLwrap_object(void *obj, hid_t connector_id, void *wrap_ctx) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE3("*x", "*xi*x", obj, connector_id, wrap_ctx); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Wrap the object */ + if(NULL == (ret_value = H5VL_wrap_object(cls, wrap_ctx, obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLwrap_object */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__attr_create + * + * Purpose: Creates an attribute through the VOL + * + * Return: Success: Pointer to the new attribute + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__attr_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'attr create' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->attr_cls.create)(obj, loc_params, name, acpl_id, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_create + * + * Purpose: Creates an attribute through the VOL + * + * Return: Success: Pointer to the new attribute + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_attr_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__attr_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, acpl_id, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_create + * + * Purpose: Creates an attribute + * + * Return: Success: Pointer to the new attribute + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, + const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, connector_id, name, acpl_id, + aapl_id, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__attr_create(obj, loc_params, cls, name, acpl_id, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create attribute") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__attr_open + * + * Purpose: Opens an attribute through the VOL + * + * Return: Success: Pointer to the attribute + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__attr_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t aapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'attr open' method") + + /* Call the corresponding VOL open callback */ + if(NULL == (ret_value = (cls->attr_cls.open)(obj, loc_params, name, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_open + * + * Purpose: Opens an attribute through the VOL + * + * Return: Success: Pointer to the attribute + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_attr_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + const char *name, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__attr_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_open + * + * Purpose: Opens an attribute + * + * Return: Success: Pointer to the attribute + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, + const char *name, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, connector_id, name, aapl_id, + dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__attr_open(obj, loc_params, cls, name, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open attribute") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__attr_read + * + * Purpose: Reads data from attr through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, void *buf, + hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.read) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr read' method") + + /* Call the corresponding VOL callback */ + if((cls->attr_cls.read)(obj, mem_type_id, buf, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "attribute read failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_read + * + * Purpose: Reads data from attr through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, void *buf, + hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__attr_read(vol_obj->data, vol_obj->connector->cls, mem_type_id, buf, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "attribute read failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_read + * + * Purpose: Reads data from an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_read(void *obj, hid_t connector_id, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xii*xi**x", obj, connector_id, mem_type_id, buf, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__attr_read(obj, cls, mem_type_id, buf, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "unable to read attribute") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__attr_write + * + * Purpose: Writes data to attr through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf, + hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.write) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr write' method") + + /* Call the corresponding VOL callback */ + if((cls->attr_cls.write)(obj, mem_type_id, buf, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_write + * + * Purpose: Writes data to attr through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, const void *buf, + hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__attr_write(vol_obj->data, vol_obj->connector->cls, mem_type_id, buf, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_write + * + * Purpose: Writes data to an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_write(void *obj, hid_t connector_id, hid_t mem_type_id, const void *buf, + hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xii*xi**x", obj, connector_id, mem_type_id, buf, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__attr_write(obj, cls, mem_type_id, buf, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "unable to write attribute") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__attr_get + * + * Purpose: Get specific information about the attribute through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr get' method") + + /* Call the corresponding VOL callback */ + if((cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "attribute get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_get + * + * Purpose: Get specific information about the attribute through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__attr_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "attribute get failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_get + * + * Purpose: Gets information about the attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_t get_type, hid_t dxpl_id, + void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVai**xx", obj, connector_id, get_type, dxpl_id, req, + arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__attr_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to get attribute information") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__attr_specific + * + * Purpose: Specific operation on attributes through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, + va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr specific' method") + + /* Call the corresponding VOL callback */ + if((ret_value = (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") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_specific + * + * Purpose: Specific operation on attributes through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if((ret_value = H5VL__attr_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_specific + * + * Purpose: Performs a connector-specific operation on an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, + H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*xxiVbi**xx", obj, loc_params, connector_id, specific_type, + dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if((ret_value = H5VL__attr_specific(obj, loc_params, cls, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__attr_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr optional' method") + + /* Call the corresponding VOL callback */ + if((ret_value = (cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if((ret_value = H5VL__attr_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_optional + * + * Purpose: Performs an optional connector-specific operation on an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if((ret_value = H5VL__attr_optional(obj, cls, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__attr_close + * + * Purpose: Closes an attribute through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->attr_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr close' method") + + /* Call the corresponding VOL callback */ + if((cls->attr_cls.close)(obj, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "attribute close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_close + * + * Purpose: Closes an attribute through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + + /* Call the corresponding internal VOL routine */ + if(H5VL__attr_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "attribute close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_close + * + * Purpose: Closes an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__attr_close(obj, cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close attribute") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLattr_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__dataset_create + * + * Purpose: Creates a dataset through the VOL + * + * Return: Success: Pointer to new dataset + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'dataset create' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->dataset_cls.create)(obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "dataset create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_create + * + * Purpose: Creates a dataset through the VOL + * + * Return: Success: Pointer to new dataset + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_dataset_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__dataset_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, dcpl_id, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "dataset create failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_create + * + * Purpose: Creates a dataset + * + * Return: Success: Pointer to the new dataset + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, + const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, connector_id, name, dcpl_id, + dapl_id, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__dataset_create(obj, loc_params, cls, name, dcpl_id, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create dataset") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__dataset_open + * + * Purpose: Opens a dataset through the VOL + * + * Return: Success: Pointer to dataset + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t dapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'dataset open' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->dataset_cls.open)(obj, loc_params, name, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_open + * + * Purpose: Opens a dataset through the VOL + * + * Return: Success: Pointer to dataset + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_dataset_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__dataset_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_open + * + * Purpose: Opens a dataset + * + * Return: Success: Pointer to the new dataset + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, + const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, connector_id, name, dapl_id, + dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__dataset_open(obj, loc_params, cls, name, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open dataset") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__dataset_read + * + * Purpose: Reads data from dataset through the VOL +* + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_read(void *obj, const H5VL_class_t *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; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.read) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset read' method") + + /* Call the corresponding VOL callback */ + if((cls->dataset_cls.read)(obj, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_read + * + * Purpose: Reads data from dataset through the VOL +* + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, + hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, + void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_read(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_read + * + * Purpose: Reads data from a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_read(void *obj, hid_t connector_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 *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE8("e", "*xiiiii*x**x", obj, connector_id, mem_type_id, mem_space_id, + file_space_id, plist_id, buf, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_read(obj, 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") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__dataset_write + * + * Purpose: Writes data from dataset through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_write(void *obj, const H5VL_class_t *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; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.write) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset write' method") + + /* Call the corresponding VOL callback */ + if((cls->dataset_cls.write)(obj, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_write + * + * Purpose: Writes data from dataset through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, + hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, + void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_write(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_write + * + * Purpose: Writes data to a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_write(void *obj, hid_t connector_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 *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE8("e", "*xiiiii*x**x", obj, connector_id, mem_type_id, mem_space_id, + file_space_id, plist_id, buf, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_write(obj, 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") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__dataset_get + * + * Purpose: Get specific information about the dataset through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset get' method") + + /* Call the corresponding VOL callback */ + if((cls->dataset_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "dataset get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_get + * + * Purpose: Get specific information about the dataset through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__dataset_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "dataset get failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_get + * + * Purpose: Gets information about a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVci**xx", obj, connector_id, get_type, dxpl_id, req, + arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute dataset get callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__dataset_specific + * + * Purpose: Specific operation on datasets through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset specific' method") + + /* Call the corresponding VOL callback */ + if((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") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_specific + * + * Purpose: Specific operation on datasets through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__dataset_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_specific + * + * Purpose: Performs a connector-specific operation on a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVdi**xx", obj, connector_id, specific_type, dxpl_id, req, + arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__dataset_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset optional' method") + + /* Call the corresponding VOL callback */ + if((cls->dataset_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, + void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Call the corresponding VOL callback */ + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__dataset_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_optional + * + * Purpose: Performs an optional connector-specific operation on a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_optional(obj, cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__dataset_close + * + * Purpose: Closes a dataset through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(obj); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->dataset_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset close' method") + + /* Call the corresponding VOL callback */ + if((cls->dataset_cls.close)(obj, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "dataset close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_close + * + * Purpose: Closes a dataset through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + HDassert(vol_obj->data); + HDassert(vol_obj->connector); + HDassert(vol_obj->connector->cls); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "dataset close failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_close + * + * Purpose: Closes a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__dataset_close(obj, cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close dataset") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdataset_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_create + * + * Purpose: Creates a file through the VOL + * + * Note: Does not have a 'static' version of the routine, since there's + * no objects in the container before this operation completes. + * + * Return: Success: Pointer to new file + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fcpl_id, + hid_t fapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'file create' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->file_cls.create)(name, flags, fcpl_id, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "file create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_create + * + * Purpose: Creates a file + * + * Return: Success: Pointer to the new file + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLfile_create(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 */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("*x", "*sIuiii**x", 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_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL connector info") + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL_file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create file") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLfile_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_open + * + * Purpose: Opens a file through the VOL. + * + * Note: Does not have a 'static' version of the routine, since there's + * no objects in the container before this operation completes. + * + * Return: Success: Pointer to file. + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fapl_id, + hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'file open' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->file_cls.open)(name, flags, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_open + * + * Purpose: Opens a file + * + * Return: Success: Pointer to the file + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, + void **req) +{ + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("*x", "*sIuii**x", 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_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL connector info") + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL_file_open(cls, name, flags, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open file") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLfile_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__file_get + * + * Purpose: Get specific information about the file through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file get' method") + + /* Call the corresponding VOL callback */ + if((cls->file_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_get + * + * Purpose: Get specific information about the file through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__file_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_get + * + * Purpose: Gets information about the file + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVgi**xx", obj, connector_id, get_type, dxpl_id, req, + arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__file_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute file get callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLfile_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__file_specific + * + * Purpose: Perform File specific operations through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file specific' method") + + /* Call the corresponding VOL callback */ + if((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_specific + * + * Purpose: Perform File specific operations through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + const H5VL_class_t *cls; /* VOL connector's class struct */ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Start access to the varargs, so they are available in all situations below */ + va_start(arguments, req); + arg_started = TRUE; + + /* Special treatment of file access check */ + if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + va_list tmp_args; /* argument list passed from the API call */ + hid_t fapl_id; /* File access property list for accessing the file */ + + /* Get the file access property list to access the file */ + va_copy(tmp_args, arguments); + fapl_id = va_arg(tmp_args, hid_t); + va_end(tmp_args); + + /* Get the VOL info from the FAPL */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a file access property list") + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector info") + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID") + } /* end if */ + /* Set wrapper info in API context, for all other operations */ + else { + /* Sanity check */ + HDassert(vol_obj); + + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Set the VOL connector class pointer */ + cls = vol_obj->connector->cls; + } /* end else */ + + + /* Call the corresponding internal VOL routine */ + if(H5VL__file_specific(vol_obj ? vol_obj->data : NULL, cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_specific + * + * Purpose: Performs a connector-specific operation on a file + * + * Note: The 'obj' parameter is allowed to be NULL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVhi**xx", obj, connector_id, specific_type, dxpl_id, req, + arguments); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__file_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file specific callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLfile_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__file_optional + * + * Purpose: Perform a connector specific operation + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file optional' method") + + /* Call the corresponding VOL callback */ + if((cls->file_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_optional + * + * Purpose: Perform a connector specific operation + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__file_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_optional + * + * Purpose: Performs an optional connector-specific operation on a file + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__file_optional(obj, cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLfile_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__file_close + * + * Purpose: Closes a file through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(obj); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->file_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file close' method") + + /* Call the corresponding VOL callback */ + if((cls->file_cls.close)(obj, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "file close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_close + * + * Purpose: Closes a file through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__file_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "file close failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_close + * + * Purpose: Closes a file + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__file_close(obj, cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLfile_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__group_create + * + * Purpose: Creates a group through the VOL + * + * Return: Success: Pointer to new group + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'group create' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->group_cls.create)(obj, loc_params, name, gcpl_id, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_create + * + * Purpose: Creates a group through the VOL + * + * Return: Success: Pointer to new group + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_group_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__group_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, gcpl_id, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_create + * + * Purpose: Creates a group + * + * Return: Success: Pointer to the new group + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, + hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, connector_id, name, gcpl_id, + gapl_id, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__group_create(obj, loc_params, cls, name, gcpl_id, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create group") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLgroup_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__group_open + * + * Purpose: Opens a group through the VOL + * + * Return: Success: Pointer to group + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + const char *name, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'group open' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->group_cls.open)(obj, loc_params, name, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "group open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_open + * + * Purpose: Opens a group through the VOL + * + * Return: Success: Pointer to group + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_group_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + const char *name, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__group_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "group open failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_open + * + * Purpose: Opens a group + * + * Return: Success: Pointer to the group + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, + hid_t gapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, connector_id, name, gapl_id, + dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__group_open(obj, loc_params, cls, name, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLgroup_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__group_get + * + * Purpose: Get specific information about the group through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group get' method") + + /* Call the corresponding VOL callback */ + if((cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_get + * + * Purpose: Get specific information about the group through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__group_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_get + * + * Purpose: Gets information about the group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVii**xx", obj, connector_id, get_type, dxpl_id, req, + arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__group_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute group get callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLgroup_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__group_specific + * + * Purpose: Specific operation on groups through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group specific' method") + + /* Call the corresponding VOL callback */ + if((cls->group_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_specific + * + * Purpose: Specific operation on groups through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__group_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_specific + * + * Purpose: Performs a connector-specific operation on a group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVji**xx", obj, connector_id, specific_type, dxpl_id, req, + arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__group_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLgroup_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__group_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group optional' method") + + /* Call the corresponding VOL callback */ + if((ret_value = (cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if((ret_value = H5VL__group_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_optional + * + * Purpose: Performs an optional connector-specific operation on a group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLgroup_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if((ret_value = H5VL__group_optional(obj, cls, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLgroup_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__group_close + * + * Purpose: Closes a group through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + /* Sanity check */ + HDassert(obj); + HDassert(cls); + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->group_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group close' method") + + /* Call the corresponding VOL callback */ + if((cls->group_cls.close)(obj, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "group close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_close + * + * Purpose: Closes a group through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__group_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "group close failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_close + * + * Purpose: Closes a group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLgroup_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__group_close(obj, cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close group") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLgroup_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__link_create + * + * Purpose: Creates a link through the VOL + * + * Note: The 'obj' parameter is allowed to be NULL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link create' method") + + /* Call the corresponding VOL callback */ + if((cls->link_cls.create)(create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_create + * + * Purpose: Creates a link through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj, + H5VL_loc_params_t loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, + void **req) +{ + H5VL_object_t tmp_vol_obj; /* Temporary object token of */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Special case for hard links */ + if(H5VL_LINK_CREATE_HARD == create_type && NULL == vol_obj->data) { + H5P_genplist_t *plist; /* Property list pointer */ + + /* Get the VOL data pointer from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a file access property list") + if(H5P_peek(plist, H5VL_PROP_LINK_TARGET, &tmp_vol_obj.data) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector info") + } /* end if */ + else + /* Use the VOL object passed in */ + tmp_vol_obj.data = vol_obj->data; + tmp_vol_obj.connector = vol_obj->connector; + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(tmp_vol_obj.data, tmp_vol_obj.connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__link_create(create_type, vol_obj->data, loc_params, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_create + * + * Purpose: Creates a link + * + * Note: The 'obj' parameter is allowed to be NULL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, + hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE8("e", "Vk*xxiiii**x", create_type, obj, loc_params, connector_id, + lcpl_id, lapl_id, dxpl_id, req); + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__link_create(create_type, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create link") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLlink_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__link_copy + * + * Purpose: Copys a link from src to dst. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.copy) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link copy' method") + + /* Call the corresponding VOL callback */ + if((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_CANTCOPY, FAIL, "link copy failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_copy + * + * Purpose: Copys a link from src to dst. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_copy(const H5VL_object_t *src_vol_obj, H5VL_loc_params_t loc_params1, + const H5VL_object_t *dst_vol_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) +{ + const H5VL_object_t *vol_obj; /* VOL object for object with data */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + vol_obj = (src_vol_obj->data ? src_vol_obj : dst_vol_obj); + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__link_copy((src_vol_obj->data ? src_vol_obj->data : NULL), loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "link copy failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_copy + * + * Purpose: Copies a link to a new location + * + * Note: The 'src_obj' and 'dst_obj' parameters are allowed to be NULL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, hid_t connector_id, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2, + connector_id, lcpl_id, lapl_id, dxpl_id, req); + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__link_copy(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLlink_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__link_move + * + * Purpose: Moves a link from src to dst. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.move) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link move' method") + + /* Call the corresponding VOL callback */ + if((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_CANTMOVE, FAIL, "link move failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_move() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_move + * + * Purpose: Moves a link from src to dst. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_move(const H5VL_object_t *src_vol_obj, H5VL_loc_params_t loc_params1, + const H5VL_object_t *dst_vol_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) +{ + const H5VL_object_t *vol_obj; /* VOL object for object with data */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + vol_obj = (src_vol_obj ? src_vol_obj : dst_vol_obj); + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__link_move((src_vol_obj ? src_vol_obj->data : NULL), loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "link move failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_move() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_move + * + * Purpose: Moves a link to another location + * + * Note: The 'src_obj' and 'dst_obj' parameters are allowed to be NULL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, hid_t connector_id, hid_t lcpl_id, + hid_t lapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2, + connector_id, lcpl_id, lapl_id, dxpl_id, req); + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__link_move(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "unable to move object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLlink_move() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__link_get + * + * Purpose: Get specific information about the link through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link get' method") + + /* Call the corresponding VOL callback */ + if((cls->link_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_get + * + * Purpose: Get specific information about the link through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_get(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__link_get(vol_obj->data, loc_params, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_get + * + * Purpose: Gets information about a link + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL_link_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*xxiVli**xx", obj, loc_params, connector_id, get_type, dxpl_id, + req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__link_get(obj, loc_params, cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute link get callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLlink_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__link_specific + * + * Purpose: Specific operation on links through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link specific' method") + + /* Call the corresponding VOL callback */ + if((ret_value = (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") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_specific + * + * Purpose: Specific operation on links through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if((ret_value = H5VL__link_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_specific + * + * Purpose: Performs a connector-specific operation on a link + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, + H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*xxiVmi**xx", obj, loc_params, connector_id, specific_type, + dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if((ret_value = H5VL__link_specific(obj, loc_params, cls, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLlink_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__link_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->link_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link optional' method") + + /* Call the corresponding VOL callback */ + if((cls->link_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__link_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_optional + * + * Purpose: Performs an optional connector-specific operation on a link + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__link_optional(obj, cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLlink_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__object_open + * + * Purpose: Opens a object through the VOL + * + * Return: Success: Pointer to the object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__object_open(void *obj, H5VL_loc_params_t params, const H5VL_class_t *cls, H5I_type_t *opened_type, + hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'object open' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->object_cls.open)(obj, params, opened_type, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "object open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_open + * + * Purpose: Opens a object through the VOL + * + * Return: Success: Pointer to the object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_object_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t params, + H5I_type_t *opened_type, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__object_open(vol_obj->data, params, vol_obj->connector->cls, opened_type, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "object open failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_open + * + * Purpose: Opens an object + * + * Return: Success: Pointer to the object + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLobject_open(void *obj, H5VL_loc_params_t params, hid_t connector_id, H5I_type_t *opened_type, + hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("*x", "*xxi*Iti**x", obj, params, connector_id, opened_type, dxpl_id, + req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__object_open(obj, params, cls, opened_type, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLobject_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__object_copy + * + * Purpose: Copies an object to another destination through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_copy(void *src_obj, H5VL_loc_params_t src_loc_params, const char *src_name, + void *dst_obj, H5VL_loc_params_t dst_loc_params, const char *dst_name, + const H5VL_class_t *cls, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, + void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.copy) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object copy' method") + + /* Call the corresponding VOL callback */ + if((cls->object_cls.copy)(src_obj, src_loc_params, src_name, dst_obj, dst_loc_params, dst_name, ocpypl_id, lcpl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "object copy failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_copy + * + * Purpose: Copies an object to another destination through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_object_copy(const H5VL_object_t *src_obj, H5VL_loc_params_t src_loc_params, + const char *src_name, const H5VL_object_t *dst_obj, H5VL_loc_params_t dst_loc_params, + const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, + void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Make sure that the VOL connectors are the same */ + if(src_obj->connector->cls->value != dst_obj->connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "objects are accessed through different VOL connectors and can't be copied") + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(src_obj->data, src_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__object_copy(src_obj->data, src_loc_params, src_name, dst_obj->data, dst_loc_params, dst_name, src_obj->connector->cls, ocpypl_id, lcpl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "object copy failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_copy + * + * Purpose: Copies an object to another location + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLobject_copy(void *src_obj, H5VL_loc_params_t src_loc_params, + const char *src_name, void *dst_obj, H5VL_loc_params_t dst_loc_params, + const char *dst_name, hid_t connector_id, hid_t ocpypl_id, hid_t lcpl_id, + hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE11("e", "*xx*s*xx*siiii**x", src_obj, src_loc_params, src_name, + dst_obj, dst_loc_params, dst_name, connector_id, ocpypl_id, lcpl_id, + dxpl_id, req); + + /* Check args and get class pointers */ + if(NULL == src_obj || NULL == dst_obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__object_copy(src_obj, src_loc_params, src_name, dst_obj, dst_loc_params, dst_name, cls, ocpypl_id, lcpl_id, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLobject_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__object_get + * + * Purpose: Get specific information about the object through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object get' method") + + /* Call the corresponding VOL callback */ + if((cls->object_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_get + * + * Purpose: Get specific information about the object through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_object_get(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__object_get(vol_obj->data, loc_params, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_get + * + * Purpose: Gets information about an object + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, H5VL_object_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*xxiVni**xx", obj, loc_params, connector_id, get_type, dxpl_id, + req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__object_get(obj, loc_params, cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute object get callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLobject_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__object_specific + * + * Purpose: Specific operation on objects through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, + va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object specific' method") + + /* Call the corresponding VOL callback */ + if((ret_value = (cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "object specific failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_specific + * + * Purpose: Specific operation on objects through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_object_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if((ret_value = H5VL__object_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "object specific failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_specific + * + * Purpose: Performs a connector-specific operation on an object + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, + H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*xxiVoi**xx", obj, loc_params, connector_id, specific_type, + dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no `object specific' method") + + /* Bypass the H5VLint layer, calling the VOL callback directly */ + if((ret_value = (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") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLobject_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__object_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->object_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object optional' method") + + /* Call the corresponding VOL callback */ + if((cls->object_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_object_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__object_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_optional + * + * Purpose: Performs an optional connector-specific operation on an object + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLobject_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__object_optional(obj, cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLobject_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__datatype_commit + * + * Purpose: Commits a datatype to the file through the VOL + * + * Return: Success: Pointer to the new datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *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) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.commit) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'datatype commit' method") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->datatype_cls.commit)(obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "datatype commit failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_commit() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_commit + * + * Purpose: Commits a datatype to the file through the VOL + * + * Return: Success: Pointer to the new datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_datatype_commit(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + 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) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__datatype_commit(vol_obj->data, loc_params, vol_obj->connector->cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "datatype commit failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_commit() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_commit + * + * Purpose: Commits a datatype to the file + * + * Return: Success: Pointer to the new datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t connector_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) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE10("*x", "*xxi*siiiii**x", obj, loc_params, connector_id, name, type_id, + lcpl_id, tcpl_id, tapl_id, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__datatype_commit(obj, loc_params, cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to commit datatype") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdatatype_commit() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__datatype_open + * + * Purpose: Opens a named datatype through the VOL + * + * Return: Success: Pointer to the datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__datatype_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "no datatype open callback") + + /* Call the corresponding VOL callback */ + if(NULL == (ret_value = (cls->datatype_cls.open)(obj, loc_params, name, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "datatype open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_open + * + * Purpose: Opens a named datatype through the VOL + * + * Return: Success: Pointer to the datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_datatype_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, + const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__datatype_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "datatype open failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_open + * + * Purpose: Opens a named datatype + * + * Return: Success: Pointer to the datatype + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, + const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, connector_id, name, tapl_id, + dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__datatype_open(obj, loc_params, cls, name, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open datatype") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdatatype_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__datatype_get + * + * Purpose: Get specific information about the datatype through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype get' method") + + /* Call the corresponding VOL callback */ + if((cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_get + * + * Purpose: Get specific information about the datatype through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__datatype_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_get + * + * Purpose: Gets information about the datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVei**xx", obj, connector_id, get_type, dxpl_id, req, + arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no `datatype get' method") + + /* Call the corresponding internal VOL routine */ + if(H5VL__datatype_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute datatype get callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdatatype_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__datatype_specific + * + * Purpose: Specific operation on datatypes through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype specific' method") + + /* Call the corresponding VOL callback */ + if((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") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_specific + * + * Purpose: Specific operation on datatypes through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__datatype_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_specific + * + * Purpose: Performs a connector-specific operation on a datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVfi**xx", obj, connector_id, specific_type, dxpl_id, req, + arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__datatype_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdatatype_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__datatype_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype optional' method") + + /* Call the corresponding VOL callback */ + if((cls->datatype_cls.optional)(obj, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, + void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__datatype_optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_optional + * + * Purpose: Performs an optional connector-specific operation on a datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_optional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__datatype_optional(obj, cls, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdatatype_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__datatype_close + * + * Purpose: Closes a datatype through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->datatype_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype close' method") + + /* Call the corresponding VOL callback */ + if((cls->datatype_cls.close)(obj, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_close + * + * Purpose: Closes a datatype through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__datatype_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_close + * + * Purpose: Closes a datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", obj, connector_id, dxpl_id, req); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__datatype_close(obj, cls, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close datatype") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLdatatype_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__request_wait + * + * Purpose: Waits on an asychronous request through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__request_wait(void *req, const H5VL_class_t *cls, uint64_t timeout, + H5ES_status_t *status) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(req); + HDassert(cls); + HDassert(status); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->request_cls.wait) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async wait' method") + + /* Call the corresponding VOL callback */ + if((cls->request_cls.wait)(req, timeout, status) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__request_wait() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_wait + * + * Purpose: Waits on an asychronous request through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout, + H5ES_status_t *status) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(vol_obj); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__request_wait(vol_obj->data, vol_obj->connector->cls, timeout, status) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_wait() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLrequest_wait + * + * Purpose: Waits on a request + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5ES_status_t *status) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xiUL*Es", req, connector_id, timeout, status); + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__request_wait(req, cls, timeout, status) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to wait on request") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLrequest_wait() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__request_cancel + * + * Purpose: Cancels an asynchronous request through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__request_cancel(void *req, const H5VL_class_t *cls) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(req); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->request_cls.cancel) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async cancel' method") + + /* Call the corresponding VOL callback */ + if((cls->request_cls.cancel)(req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__request_cancel() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_cancel + * + * Purpose: Cancels an asynchronous request through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_cancel(const H5VL_object_t *vol_obj) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if(H5VL__request_cancel(vol_obj->data, vol_obj->connector->cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_cancel() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLrequest_cancel + * + * Purpose: Cancels a request + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_cancel(void *req, hid_t connector_id) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "*xi", req, connector_id); + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__request_cancel(req, cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to cancel request") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLrequest_cancel() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__request_specific + * + * Purpose: Specific operation on asynchronous request through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__request_specific(void *req, const H5VL_class_t *cls, + H5VL_request_specific_t specific_type, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(req); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->request_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async specific' method") + + /* Call the corresponding VOL callback */ + if((ret_value = (cls->request_cls.specific)(req, specific_type, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__request_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_specific + * + * Purpose: Specific operation on asynchronous request through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_specific(const H5VL_object_t *vol_obj, + H5VL_request_specific_t specific_type, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, specific_type); + arg_started = TRUE; + if((ret_value = H5VL__request_specific(vol_obj->data, vol_obj->connector->cls, specific_type, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLrequest_specific + * + * Purpose: Performs a connector-specific operation on an asynchronous request + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_t specific_type, + va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xiVrx", req, connector_id, specific_type, arguments); + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if((ret_value = H5VL__request_specific(req, cls, specific_type, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLrequest_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__request_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__request_optional(void *req, const H5VL_class_t *cls, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(req); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->request_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async optional' method") + + /* Call the corresponding VOL callback */ + if((ret_value = (cls->request_cls.optional)(req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__request_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_optional(const H5VL_object_t *vol_obj, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + va_start(arguments, vol_obj); + arg_started = TRUE; + if((ret_value = H5VL__request_optional(vol_obj->data, vol_obj->connector->cls, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLrequest_optional + * + * Purpose: Performs an optional connector-specific operation on an asynchronous request + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_optional(void *req, hid_t connector_id, va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE3("e", "*xix", req, connector_id, arguments); + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if((ret_value = H5VL__request_optional(req, cls, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLrequest_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__request_free + * + * Purpose: Frees an asynchronous request through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__request_free(void *req, const H5VL_class_t *cls) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(req); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->request_cls.free) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async free' method") + + /* Call the corresponding VOL callback */ + if((cls->request_cls.free)(req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__request_free() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_free + * + * Purpose: Frees an asynchronous request through the VOL + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_free(const H5VL_object_t *vol_obj) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding VOL callback */ + if(H5VL__request_free(vol_obj->data, vol_obj->connector->cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed") + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_free() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLrequest_free + * + * Purpose: Frees a request + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_free(void *req, hid_t connector_id) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "*xi", req, connector_id); + + /* Get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(H5VL__request_free(req, cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to free request") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLrequest_free() */ + diff --git a/src/H5VLint.c b/src/H5VLint.c index e246989..4590885 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -30,11 +30,11 @@ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ #include "H5Tprivate.h" /* Datatypes */ #include "H5VLpkg.h" /* Virtual Object Layer */ @@ -43,19 +43,33 @@ /* Local Macros */ /****************/ + /******************/ /* Local Typedefs */ /******************/ +/* Object wrapping context info */ +typedef struct H5VL_wrap_ctx_t { + unsigned rc; /* Ref. count for the # of times the context was set / reset */ + const H5VL_t *connector; /* VOL connector for "outermost" class to start wrap */ + void *obj_wrap_ctx; /* "wrap context" for outermost connector */ +} H5VL_wrap_ctx_t; + + /********************/ /* Package Typedefs */ /********************/ + /********************/ /* Local Prototypes */ /********************/ +static herr_t H5VL__free_cls(H5VL_class_t *cls); +static void *H5VL__wrap_obj(void *obj); +static H5VL_object_t *H5VL__new_vol_obj(H5I_type_t type, void *object, + H5VL_t *vol_connector, hbool_t wrap_obj); +static void *H5VL__object(hid_t id, H5I_type_t obj_type); -static herr_t H5VL_free_cls(H5VL_class_t *cls); /*********************/ /* Package Variables */ @@ -64,6 +78,7 @@ static herr_t H5VL_free_cls(H5VL_class_t *cls); /* Package initialization variable */ hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ /*****************************/ @@ -77,15 +92,22 @@ static const H5I_class_t H5I_VOL_CLS[1] = {{ H5I_VOL, /* ID class value */ 0, /* Class flags */ 0, /* # of reserved IDs for class */ - (H5I_free_t)H5VL_free_cls /* Callback routine for closing objects of this class */ + (H5I_free_t)H5VL__free_cls /* Callback routine for closing objects of this class */ }}; +/* Declare a free list to manage the H5VL_class_t struct */ +H5FL_DEFINE_STATIC(H5VL_class_t); + /* Declare a free list to manage the H5VL_t struct */ H5FL_DEFINE(H5VL_t); /* Declare a free list to manage the H5VL_object_t struct */ H5FL_DEFINE(H5VL_object_t); +/* Declare a free list to manage the H5VL_wrap_ctx_t struct */ +H5FL_DEFINE_STATIC(H5VL_wrap_ctx_t); + + /*------------------------------------------------------------------------- * Function: H5VL_init @@ -132,7 +154,7 @@ H5VL__init_package(void) /* Initialize the atom group for the VL IDs */ if (H5I_register_type(H5I_VOL_CLS) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize H5VL interface"); + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize H5VL interface") done: FUNC_LEAVE_NOAPI(ret_value) @@ -157,27 +179,27 @@ H5VL_term_package(void) FUNC_ENTER_NOAPI_NOINIT_NOERR - if (H5_PKG_INIT_VAR) { + if(H5_PKG_INIT_VAR) { if (H5I_nmembers(H5I_VOL) > 0) { (void)H5I_clear_type(H5I_VOL, FALSE, FALSE); n++; - } + } /* end if */ else { - /* Destroy the VOL driver ID group */ + /* Destroy the VOL connector ID group */ n += (H5I_dec_type_ref(H5I_VOL) > 0); /* Mark interface as closed */ if (0 == n) H5_PKG_INIT_VAR = FALSE; - } - } + } /* end else */ + } /* end if */ FUNC_LEAVE_NOAPI(n) } /* end H5VL_term_package() */ /*------------------------------------------------------------------------- - * Function: H5VL_free_cls + * Function: H5VL__free_cls * * Purpose: Frees a file VOL class struct and returns an indication of * success. This function is used as the free callback for the @@ -189,27 +211,125 @@ H5VL_term_package(void) *------------------------------------------------------------------------- */ static herr_t -H5VL_free_cls(H5VL_class_t *cls) +H5VL__free_cls(H5VL_class_t *cls) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(cls); - /* XXX: Need to retrieve the VOL termination property list for the - * terminate operation - JTH - */ - if (cls->terminate && cls->terminate(H5P_DEFAULT) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL driver did not terminate cleanly"); + /* Shut down the VOL connector */ + if(cls->terminate && cls->terminate() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly") + + /* Release the class */ + H5MM_xfree(cls->name); + H5FL_FREE(H5VL_class_t, cls); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__free_cls() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__wrap_obj + * + * Purpose: Wraps a library object with possible VOL connector wrappers, to + * match the VOL connector stack for the file. + * + * Return: Success: Wrapped object pointer + * Failure: NULL + * + * Programmer: Quincey Koziol + * Friday, October 7, 2018 + * + *------------------------------------------------------------------------- + */ +static void * +H5VL__wrap_obj(void *obj) +{ + H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check arguments */ + HDassert(obj); + + /* Retrieve the VOL object wrapping context */ + if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't get VOL object wrap context") + + /* If there is a VOL object wrapping context, wrap the object */ + if(vol_wrap_ctx) { + /* Wrap object, using the VOL callback */ + if(NULL == (ret_value = H5VL_wrap_object(vol_wrap_ctx->connector->cls, vol_wrap_ctx->obj_wrap_ctx, obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object") + } /* end if */ + else + ret_value = obj; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__wrap_obj() */ - /* XXX (VOL MERGE): We'll leak memory if the name string was dynamically allocated. */ - H5MM_xfree(cls); + +/*------------------------------------------------------------------------- + * Function: H5VL__new_vol_obj + * + * Purpose: Creates a new VOL object, to use when registering an ID. + * + * Return: Success: VOL object pointer + * Failure: NULL + * + * Programmer: Quincey Koziol + * Friday, October 7, 2018 + * + *------------------------------------------------------------------------- + */ +static H5VL_object_t * +H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t wrap_obj) +{ + H5VL_object_t *new_vol_obj = NULL; /* Pointer to new VOL object */ + H5VL_object_t *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check arguments */ + HDassert(object); + HDassert(vol_connector); + + /* Make sure type number is valid */ + if(type != H5I_ATTR && type != H5I_DATASET && type != H5I_DATATYPE && type != H5I_FILE && type != H5I_GROUP) + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, NULL, "invalid type number") + + /* Create the new VOL object */ + if(NULL == (new_vol_obj = H5FL_CALLOC(H5VL_object_t))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate memory for VOL object") + new_vol_obj->connector = vol_connector; + if(wrap_obj) { + if(NULL == (new_vol_obj->data = H5VL__wrap_obj(object))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "can't wrap library object") + } /* end if */ + else + new_vol_obj->data = object; + + /* Bump the reference count on the VOL connector */ + vol_connector->nrefs++; + + /* If this is a datatype, we have to hide the VOL object under the H5T_t pointer */ + if(H5I_DATATYPE == type) { + if(NULL == (ret_value = (H5VL_object_t *)H5T_construct_datatype(new_vol_obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "can't construct datatype object") + } /* end if */ + else + ret_value = (H5VL_object_t *)new_vol_obj; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_free_cls() */ +} /* end H5VL__new_vol_obj() */ /*------------------------------------------------------------------------- @@ -225,40 +345,25 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VL_register(H5I_type_t type, const void *object, H5VL_t *vol_driver, hbool_t app_ref) +H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref) { - H5VL_object_t *vol_obj = NULL; - hid_t ret_value = H5I_INVALID_HID; + H5VL_object_t *vol_obj = NULL; /* VOL object wrapper for library object */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Check arguments */ HDassert(object); - HDassert(vol_driver); - - /* Set up VOL object to wrap the passed-in data */ - if (NULL == (vol_obj = H5FL_CALLOC(H5VL_object_t))) - HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate top object structure"); - vol_obj->driver = vol_driver; - vol_obj->data = object; + HDassert(vol_connector); - vol_driver->nrefs++; - - /* Datatypes need special handling under the VOL, since they have a non-VOL aspect */ - if (H5I_DATATYPE == type) { - - H5T_t *dt = NULL; - - if (NULL == (dt = H5T_construct_datatype(vol_obj))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "can't construct datatype object"); - - if ((ret_value = H5I_register(type, dt, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle"); - } - else { - if ((ret_value = H5I_register(type, vol_obj, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle"); - } + /* Set up VOL object for the passed-in data */ + /* (Does not wrap object, since it's from a VOL callback) */ + if(NULL == (vol_obj = H5VL__new_vol_obj(type, object, vol_connector, FALSE))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object") + + /* Register VOL object as _object_ type, for future object API calls */ + if((ret_value = H5I_register(type, vol_obj, app_ref)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle") done: FUNC_LEAVE_NOAPI(ret_value) @@ -284,41 +389,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref, hid_t existing_id) +H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref, hid_t existing_id) { H5VL_object_t *new_vol_obj = NULL; /* Pointer to new VOL object */ - void *stored_obj = NULL; /* Pointer to the object that will be stored */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ HDassert(object); - HDassert(vol_driver); + HDassert(vol_connector); - /* Make sure type number is valid */ - if(type != H5I_ATTR && type != H5I_DATASET && type != H5I_DATATYPE && type != H5I_FILE && type != H5I_GROUP) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - - /* Set up the new VOL object */ - if(NULL == (new_vol_obj = H5FL_CALLOC(H5VL_object_t))) - HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate memory for VOL object"); - new_vol_obj->driver = vol_driver; - new_vol_obj->data = object; - - /* Bump the reference count on the VOL driver */ - vol_driver->nrefs++; - - /* If this is a datatype, we have to hide the VOL object under the H5T_t pointer */ - if(H5I_DATATYPE == type) { - if(NULL == (stored_obj = (void *)H5T_construct_datatype(new_vol_obj))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't construct datatype object"); - } - else - stored_obj = (void *)new_vol_obj; + /* Set up VOL object for the passed-in data */ + /* (Wraps object, since it's a library object) */ + if(NULL == (new_vol_obj = H5VL__new_vol_obj(type, object, vol_connector, TRUE))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object") /* Call the underlying H5I function to complete the registration */ - if(H5I_register_using_existing_id(type, stored_obj, app_ref, existing_id) < 0) + if(H5I_register_using_existing_id(type, new_vol_obj, app_ref, existing_id) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register object under existing ID") done: @@ -330,8 +418,8 @@ done: * Function: H5VL_register_using_vol_id * * Purpose: Utility function to create a user ID for an object created - * or opened through the VOL. Uses the VOL driver's ID to - * get the driver information instead of it being passed in. + * or opened through the VOL. Uses the VOL connector's ID to + * get the connector information instead of it being passed in. * * Return: Success: A valid HDF5 ID * Failure: H5I_INVALID_HID @@ -339,28 +427,29 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VL_register_using_vol_id(H5I_type_t type, const void *obj, hid_t driver_id, hbool_t app_ref) +H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool_t app_ref) { H5VL_class_t *cls = NULL; - H5VL_t *driver = NULL; /* VOL driver struct */ + H5VL_t *connector = NULL; /* VOL connector struct */ hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_NOAPI(FAIL) - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL driver ID"); + /* Get the VOL class object from the connector's ID */ + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL connector ID") /* Setup VOL info struct */ - if (NULL == (driver = H5FL_CALLOC(H5VL_t))) - HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VOL info struct"); - driver->cls = cls; - driver->id = driver_id; - if (H5I_inc_ref(driver->id, FALSE) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver"); + if (NULL == (connector = H5FL_CALLOC(H5VL_t))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate VOL info struct") + connector->cls = cls; + connector->id = connector_id; + if (H5I_inc_ref(connector->id, FALSE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") /* Get an ID for the VOL object */ - if ((ret_value = H5VL_register(type, obj, driver, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle"); + if ((ret_value = H5VL_register(type, obj, connector, app_ref)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") done: FUNC_LEAVE_NOAPI(ret_value) @@ -371,7 +460,7 @@ done: * Function: H5VL_free_object * * Purpose: Wrapper to unregister an object ID with a VOL aux struct - * and decrement ref count on VOL driver ID + * and decrement ref count on VOL connector ID * * Return: SUCCEED/FAIL * @@ -387,13 +476,13 @@ H5VL_free_object(H5VL_object_t *vol_obj) /* Check arguments */ HDassert(vol_obj); - vol_obj->driver->nrefs --; + vol_obj->connector->nrefs --; - if (0 == vol_obj->driver->nrefs) { - if (H5I_dec_ref(vol_obj->driver->id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL driver"); - vol_obj->driver = H5FL_FREE(H5VL_t, vol_obj->driver); - } + if(0 == vol_obj->connector->nrefs) { + if(H5I_dec_ref(vol_obj->connector->id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector") + vol_obj->connector = H5FL_FREE(H5VL_t, vol_obj->connector); + } /* end if */ vol_obj = H5FL_FREE(H5VL_object_t, vol_obj); @@ -403,20 +492,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_register_driver + * Function: H5VL_register_connector * - * Purpose: Registers a new VOL driver as a member of the virtual object + * Purpose: Registers a new VOL connector as a member of the virtual object * layer class. * - * Return: Success: A VOL driver ID which is good until the - * library is closed or the driver is unregistered. + * Return: Success: A VOL connector ID which is good until the + * library is closed or the connector is unregistered. * * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t -H5VL_register_driver(const void *_cls, size_t size, hbool_t app_ref) +H5VL_register_connector(const void *_cls, hbool_t app_ref, hid_t vipl_id) { const H5VL_class_t *cls = (const H5VL_class_t *)_cls; H5VL_class_t *saved = NULL; @@ -428,38 +517,44 @@ H5VL_register_driver(const void *_cls, size_t size, hbool_t app_ref) HDassert(cls); /* Copy the class structure so the caller can reuse or free it */ - if (NULL == (saved = (H5VL_class_t *)H5MM_calloc(size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed for VOL driver class struct"); - HDmemcpy(saved, cls, size); + if (NULL == (saved = H5FL_CALLOC(H5VL_class_t))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "memory allocation failed for VOL connector class struct") + HDmemcpy(saved, cls, sizeof(H5VL_class_t)); + if(NULL == (saved->name = H5MM_strdup(cls->name))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "memory allocation failed for VOL connector name") + + /* Initialize the VOL connector */ + if(cls->initialize && cls->initialize(vipl_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to init VOL connector") /* Create the new class ID */ if ((ret_value = H5I_register(H5I_VOL, saved, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL driver ID"); + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID") done: if (ret_value < 0) if (saved) - H5MM_xfree(saved); + H5FL_FREE(H5VL_class_t, saved); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_register_driver() */ +} /* end H5VL_register_connector() */ /*------------------------------------------------------------------------- - * Function: H5VL_get_driver_name + * Function: H5VL_get_connector_name * - * Purpose: Private version of H5VLget_driver_name + * Purpose: Private version of H5VLget_connector_name * - * Return: Success: The length of the driver name + * Return: Success: The length of the connector name * Failure: Negative * *------------------------------------------------------------------------- */ ssize_t -H5VL_get_driver_name(hid_t id, char *name /*out*/, size_t size) +H5VL_get_connector_name(hid_t id, char *name /*out*/, size_t size) { - H5VL_object_t *vol_obj = NULL; - const H5VL_class_t *cls = NULL; + H5VL_object_t *vol_obj; + const H5VL_class_t *cls; size_t len; ssize_t ret_value = -1; @@ -467,23 +562,23 @@ H5VL_get_driver_name(hid_t id, char *name /*out*/, size_t size) /* get the object pointer */ if (NULL == (vol_obj = H5VL_vol_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid VOL identifier") - cls = vol_obj->driver->cls; + cls = vol_obj->connector->cls; len = HDstrlen(cls->name); - if (name) { - HDstrncpy(name, cls->name, MIN(len + 1,size)); - if (len >= size) - name[size-1]='\0'; - } + if(name) { + HDstrncpy(name, cls->name, MIN(len + 1, size)); + if(len >= size) + name[size - 1] = '\0'; + } /* end if */ /* Set the return value for the API call */ ret_value = (ssize_t)len; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_get_driver_name() */ +} /* end H5VL_get_connector_name() */ /*------------------------------------------------------------------------- @@ -503,145 +598,105 @@ H5VL_object_t * H5VL_vol_object(hid_t id) { void *obj = NULL; - H5I_type_t obj_type = H5I_get_type(id); + H5I_type_t obj_type; H5VL_object_t *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) + obj_type = H5I_get_type(id); if (H5I_FILE == obj_type || H5I_GROUP == obj_type || H5I_ATTR == obj_type || - H5I_DATASET == obj_type || H5I_DATATYPE == obj_type) { - /* get the object */ + H5I_DATASET == obj_type || H5I_DATATYPE == obj_type) { + /* Get the object */ if (NULL == (obj = H5I_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") /* if this is a datatype, get the VOL object attached to the H5T_t struct */ - if (H5I_DATATYPE == obj_type) { + if (H5I_DATATYPE == obj_type) if (NULL == (obj = H5T_get_named_type((H5T_t *)obj))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype"); - } - } + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype") + } /* end if */ else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier type to function"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier type to function") ret_value = (H5VL_object_t *)obj; + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_vol_object() */ /*------------------------------------------------------------------------- - * Function: H5VL_object + * Function: H5VL_object_data * - * Purpose: Utility function to return the VOL object pointer associated with - * a hid_t. + * Purpose: Correctly retrieve the 'data' field for a VOL object (H5VL_object), + * even for nested / stacked VOL connectors. * - * Return: Success: object pointer - * Failure: NULL + * Return: Success: object pointer + * Failure: NULL * *------------------------------------------------------------------------- */ void * -H5VL_object(hid_t id) +H5VL_object_data(const H5VL_object_t *vol_obj) { - H5VL_object_t *vol_obj = NULL; - void *ret_value = NULL; - - FUNC_ENTER_NOAPI(NULL) + void *ret_value = NULL; - /* Get the symbol table entry */ - switch (H5I_get_type(id)) { - case H5I_GROUP: - case H5I_DATASET: - case H5I_FILE: - case H5I_ATTR: - /* get the object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); - - ret_value = vol_obj->data; - break; - case H5I_DATATYPE: - { - H5T_t *dt = NULL; - - /* get the object */ - if (NULL == (dt = (H5T_t *)H5I_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); + FUNC_ENTER_NOAPI_NOINIT_NOERR - /* Get the actual datatype object that should be the vol_obj */ - if (NULL == (vol_obj = H5T_get_named_type(dt))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype"); + /* Check for 'get_object' callback in connector */ + if(vol_obj->connector->cls->get_object) + ret_value = (vol_obj->connector->cls->get_object)(vol_obj->data); + else + ret_value = vol_obj->data; - ret_value = vol_obj->data; - break; - } - case H5I_UNINIT: - case H5I_BADID: - case H5I_DATASPACE: - case H5I_REFERENCE: - case H5I_VFL: - case H5I_VOL: - case H5I_GENPROP_CLS: - case H5I_GENPROP_LST: - case H5I_ERROR_CLASS: - case H5I_ERROR_MSG: - case H5I_ERROR_STACK: - case H5I_NTYPES: - default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unknown data object type"); - } -done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object() */ +} /* end H5VL_object_data() */ /*------------------------------------------------------------------------- - * Function: H5VL_object_verify + * Function: H5VL__object * - * Purpose: Utility function to return the VOL object pointer associated - * with an identifier. + * Purpose: Internal function to return the VOL object pointer associated + * with an hid_t. * * Return: Success: object pointer * Failure: NULL * *------------------------------------------------------------------------- */ -void * -H5VL_object_verify(hid_t id, H5I_type_t obj_type) +static void * +H5VL__object(hid_t id, H5I_type_t obj_type) { H5VL_object_t *vol_obj = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC - /* Get the symbol table entry */ - switch (obj_type) { + /* Get the underlying object */ + switch(obj_type) { case H5I_GROUP: case H5I_DATASET: case H5I_FILE: case H5I_ATTR: /* get the object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(id, obj_type))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); - - ret_value = vol_obj->data; + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") break; + case H5I_DATATYPE: { H5T_t *dt = NULL; /* get the object */ - if (NULL == (dt = (H5T_t *)H5I_object_verify(id, obj_type))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); + if (NULL == (dt = (H5T_t *)H5I_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") /* Get the actual datatype object that should be the vol_obj */ if (NULL == (vol_obj = H5T_get_named_type(dt))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype"); - - ret_value = vol_obj->data; + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype") break; } + case H5I_UNINIT: case H5I_BADID: case H5I_DATASPACE: @@ -656,1613 +711,293 @@ H5VL_object_verify(hid_t id, H5I_type_t obj_type) case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unknown data object type") - } -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_verify() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_driver_data - * - * Purpose: Get the VOL-specific data stored in a VOL object - * - * Return: Success: Pointer to the data - * - * Failure: NULL (technically can't fail) - * - *------------------------------------------------------------------------- - */ -void * -H5VL_driver_data(H5VL_object_t *vol_obj) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(vol_obj); - - FUNC_LEAVE_NOAPI(vol_obj->data) -} /* end H5VL_driver_data() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_attr_create - * - * Purpose: Creates an attribute through the VOL - * - * Return: Success: pointer to the new attribute - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) -{ - void *ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the corresponding VOL create callback exists */ - if (NULL == cls->attr_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'attr create' method") - - /* call the corresponding VOL create callback */ - if (NULL == (ret_value = (cls->attr_cls.create) - (obj, loc_params, name, acpl_id, aapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_attr_open - * - * Purpose: Opens an attribute through the VOL - * - * Return: Success: pointer to the new attr. - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t aapl_id, hid_t dxpl_id, void **req) -{ - void *ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the type specific corresponding VOL open callback exists */ - if(NULL == cls->attr_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'attr open' method") - - /* call the corresponding VOL open callback */ - if(NULL == (ret_value = (cls->attr_cls.open) - (obj, loc_params, name, aapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_attr_read - * - * Purpose: Reads data from attr through the VOL - * - * Return: Success: Non Negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t H5VL_attr_read(void *attr, const H5VL_class_t *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 == cls->attr_cls.read) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr read' method") - if((ret_value = (cls->attr_cls.read)(attr, mem_type_id, buf, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "read failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_read() */ + } /* end switch */ - -/*------------------------------------------------------------------------- - * Function: H5VL_attr_write - * - * Purpose: Writes data to attr through the VOL - * - * Return: Success: Non Negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t H5VL_attr_write(void *attr, const H5VL_class_t *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 == cls->attr_cls.write) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr write' method") - if((ret_value = (cls->attr_cls.write)(attr, mem_type_id, buf, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "write failed") + /* Set the return value */ + ret_value = H5VL_object_data(vol_obj); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_write() */ +} /* end H5VL__object() */ /*------------------------------------------------------------------------- - * Function: H5VL_attr_get - * - * Purpose: Get specific information about the attribute through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, - 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 == cls->attr_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr get' method") - - va_start (arguments, req); - if((ret_value = (cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_attr_specific - * - * Purpose: specific operation on attributes through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, - H5VL_attr_specific_t specific_type, 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 == cls->attr_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr specific' method") - - va_start (arguments, req); - if((ret_value = (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); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_attr_optional - * - * Purpose: optional operation specific to drivers. - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_attr_optional(void *obj, const H5VL_class_t *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 == cls->attr_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr optional' method") - - va_start (arguments, req); - if((ret_value = (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); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_attr_close - * - * Purpose: Closes an attribute through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_attr_close(void *attr, const H5VL_class_t *cls, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; - - HDassert(attr); - HDassert(cls); - - FUNC_ENTER_NOAPI(FAIL) - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->attr_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr close' method"); - - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->attr_cls.close)(attr, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_dataset_create - * - * Purpose: Creates a dataset through the VOL + * Function: H5VL_object * - * Return: Success: pointer to dataset + * Purpose: Utility function to return the VOL object pointer associated with + * a hid_t. * - * Failure: NULL + * Return: Success: object pointer + * Failure: NULL * *------------------------------------------------------------------------- */ void * -H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) +H5VL_object(hid_t id) { - void *ret_value; /* Return value */ + void *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) - /* check if the corresponding VOL create callback exists */ - if(NULL == cls->dataset_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'dataset create' method") - - /* call the corresponding VOL create callback */ - if(NULL == (ret_value = (cls->dataset_cls.create) - (obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + /* Get the underlying object */ + if(NULL == (ret_value = H5VL__object(id, H5I_get_type(id)))) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, NULL, "can't retrieve object for ID") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_create() */ +} /* end H5VL_object() */ /*------------------------------------------------------------------------- - * Function: H5VL_dataset_open - * - * Purpose: Opens a dataset through the VOL + * Function: H5VL_object_verify * - * Return: Success: pointer to dataset + * Purpose: Utility function to return the VOL object pointer associated + * with an identifier. * - * Failure: NULL + * Return: Success: object pointer + * Failure: NULL * *------------------------------------------------------------------------- */ void * -H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t dapl_id, hid_t dxpl_id, void **req) +H5VL_object_verify(hid_t id, H5I_type_t obj_type) { - void *ret_value; /* Return value */ + void *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) - /* check if the type specific corresponding VOL open callback exists */ - if(NULL == cls->dataset_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'dset open' method") - - /* call the corresponding VOL open callback */ - if(NULL == (ret_value = (cls->dataset_cls.open) - (obj, loc_params, name, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_dataset_read - * - * Purpose: Reads data from dataset through the VOL -* - * Return: Success: Non Negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_dataset_read(void *dset, const H5VL_class_t *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) + /* Check of ID of correct type */ + if(obj_type != H5I_get_type(id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") - if(NULL == cls->dataset_cls.read) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset read' method") - if((ret_value = (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") + /* Get the underlying object */ + if(NULL == (ret_value = H5VL__object(id, obj_type))) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, NULL, "can't retrieve object for ID") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_read() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_dataset_write - * - * Purpose: Writes data from dataset through the VOL - * - * Return: Success: Non Negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_dataset_write(void *dset, const H5VL_class_t *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 == cls->dataset_cls.write) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset write' method") - if((ret_value = (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") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_write() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_dataset_get - * - * Purpose: Get specific information about the dataset through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_dataset_get(void *dset, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, - 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 == cls->dataset_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset get' method") - - va_start (arguments, req); - if((ret_value = (cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_get() */ +} /* end H5VL_object_verify() */ /*------------------------------------------------------------------------- - * Function: H5VL_dataset_specific + * Function: H5VL_cmp_connector_cls * - * Purpose: specific operation on datasets through the VOL + * Purpose: Compare VOL class for a connector * - * Return: Success: non negative - * - * Failure: negative + * Return: Positive if VALUE1 is greater than VALUE2, negative if + * VALUE2 is greater than VALUE1 and zero if VALUE1 and + * VALUE2 are equal. * *------------------------------------------------------------------------- */ -herr_t -H5VL_dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type, - hid_t dxpl_id, void **req, ...) +int +H5VL_cmp_connector_cls(const H5VL_class_t *cls1, const H5VL_class_t *cls2) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + int cmp_value; /* Value from comparison */ + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if(NULL == cls->dataset_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset specific' method") + /* Sanity checks */ + HDassert(cls1); + HDassert(cls1); - va_start (arguments, req); - if((ret_value = (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); + /* Compare connector "values" */ + if(cls1->value < cls2->value) + HGOTO_DONE(-1) + if(cls1->value > cls2->value) + HGOTO_DONE(1) + HDassert(cls1->value == cls2->value); -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_specific() */ + /* Compare connector names */ + if(cls1->name == NULL && cls2->name != NULL) + HGOTO_DONE(-1); + if(cls1->name != NULL && cls2->name == NULL) + HGOTO_DONE(1); + if(0 != (cmp_value = HDstrcmp(cls1->name, cls2->name))) + HGOTO_DONE(cmp_value); - -/*------------------------------------------------------------------------- - * Function: H5VL_dataset_optional - * - * Purpose: optional operation specific to drivers. - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + /* Compare connector VOL API versions */ + if(cls1->version < cls2->version) + HGOTO_DONE(-1) + if(cls1->version > cls2->version) + HGOTO_DONE(1) + HDassert(cls1->version == cls2->version); - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->dataset_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset optional' method") - - va_start (arguments, req); - if((ret_value = (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); + /* Compare connector info */ + if(cls1->info_size < cls2->info_size) + HGOTO_DONE(-1) + if(cls1->info_size > cls2->info_size) + HGOTO_DONE(1) + HDassert(cls1->info_size == cls2->info_size); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_optional() */ +} /* end H5VL_cmp_connector_cls() */ /*------------------------------------------------------------------------- - * Function: H5VL_dataset_close + * Function: H5VL_set_vol_wrapper * - * Purpose: Closes a dataset through the VOL + * Purpose: Set up object wrapping context for current VOL connector * - * Return: SUCCEED/FAIL + * Return: SUCCEED / FAIL * *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_close(void *dset, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +H5VL_set_vol_wrapper(void *obj, const H5VL_t *connector) { - herr_t ret_value = SUCCEED; + H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */ + void *obj_wrap_ctx = NULL; /* VOL connector's wrapping context */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - HDassert(dset); - HDassert(cls); + /* Sanity checks */ + HDassert(obj); + HDassert(connector); - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->dataset_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dset close' method"); + /* Retrieve the VOL object wrap context */ + if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL object wrap context") - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->dataset_cls.close)(dset, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed"); + /* Check for existing wrapping context */ + if(NULL == vol_wrap_ctx) { + /* Check if the connector can create a wrap context */ + if(connector->cls->get_wrap_ctx) { + /* Sanity check */ + HDassert(connector->cls->free_wrap_ctx); -done: + /* Get the wrap context from the connector */ + if((connector->cls->get_wrap_ctx)(obj, &obj_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve VOL connector's object wrap context") + } /* end if */ - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_close() */ + /* Allocate VOL object wrapper context */ + if(NULL == (vol_wrap_ctx = H5FL_MALLOC(H5VL_wrap_ctx_t))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate VOL wrap context") - -/*------------------------------------------------------------------------- - * Function: H5VL_file_create - * - * Purpose: Creates a file through the VOL - * - * Return: Success: pointer to file. - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fcpl_id, - hid_t fapl_id, hid_t dxpl_id, void **req) -{ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the corresponding VOL create callback exists */ - if(NULL == cls->file_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'file create' method") - /* call the corresponding VOL create callback */ - if(NULL == (ret_value = (cls->file_cls.create)(name, flags, fcpl_id, fapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_file_open - * - * Purpose: Opens a file through the VOL. - * - * Return: Success: pointer to file. - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fapl_id, - hid_t dxpl_id, void **req) -{ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) + /* Set up VOL object wrapper context */ + vol_wrap_ctx->rc = 1;; + vol_wrap_ctx->connector = connector; + vol_wrap_ctx->obj_wrap_ctx = obj_wrap_ctx; + } /* end if */ + else + /* Incremeent ref count on existing wrapper context */ + vol_wrap_ctx->rc++; - /* check if the corresponding VOL create callback exists */ - if(NULL == cls->file_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'file open' method") - /* call the corresponding VOL create callback */ - if(NULL == (ret_value = (cls->file_cls.open)(name, flags, fapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "open failed") + /* Save the wrapper context */ + if(H5CX_set_vol_wrap_ctx(vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_open() */ + if(ret_value < 0 && vol_wrap_ctx) + /* Release object wrapping context */ + H5FL_FREE(H5VL_wrap_ctx_t, vol_wrap_ctx); - -/*------------------------------------------------------------------------- - * Function: H5VL_file_get - * - * Purpose: Get specific information about the file through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_file_get(void *file, const H5VL_class_t *cls, H5VL_file_get_t get_type, - 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 == cls->file_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'file get' method") - - va_start(arguments, req); - if((ret_value = (cls->file_cls.get)(file, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end(arguments); - -done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_get() */ +} /* end H5VL_set_vol_wrapper() */ /*------------------------------------------------------------------------- - * Function: H5VL_file_specific + * Function: H5VL_reset_vol_wrapper * - * Purpose: perform File specific operations through the VOL + * Purpose: Reset object wrapping context for current VOL connector * - * Return: Success: non negative - * Failure: negative + * Return: SUCCEED / FAIL * *------------------------------------------------------------------------- */ herr_t -H5VL_file_specific(void *file, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, - hid_t dxpl_id, void **req, ...) +H5VL_reset_vol_wrapper(void) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { - H5P_genplist_t *plist; /* Property list pointer */ - H5VL_driver_prop_t driver_prop; /* Property for VOL driver ID & info */ - va_list tmp_args; /* argument list passed from the API call */ - hid_t fapl_id; + /* Retrieve the VOL object wrap context */ + if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL object wrap context") - va_start (tmp_args, req); - fapl_id = va_arg (tmp_args, hid_t); - va_end (tmp_args); + /* Check for VOL object wrap context */ + if(NULL == vol_wrap_ctx) + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "no VOL object wrap context?") - /* 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") + /* Decrement ref count on wrapping context */ + vol_wrap_ctx->rc--; - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL driver info") + /* Release context if the ref count drops to zero */ + if(0 == vol_wrap_ctx->rc) { + /* If there is a VOL connector object wrapping context, release it */ + if(vol_wrap_ctx->obj_wrap_ctx) { + /* Release the VOL connector's object wrapping context */ + if((*vol_wrap_ctx->connector->cls->free_wrap_ctx)(vol_wrap_ctx->obj_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release connector's object wrapping context") + } /* end if */ - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + /* Release object wrapping context */ + H5FL_FREE(H5VL_wrap_ctx_t, vol_wrap_ctx); - va_start (arguments, req); - if((ret_value = (cls->file_cls.specific) - (file, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") - va_end (arguments); - } + /* Reset the wrapper context */ + if(H5CX_set_vol_wrap_ctx(NULL) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context") + } /* end if */ else { - if(NULL == cls->file_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'file specific' method") - - va_start (arguments, req); - if((ret_value = (cls->file_cls.specific) - (file, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") - va_end (arguments); - } - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_file_optional - * - * Purpose: perform a driver specific operation - * - * Return: Success: non negative - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_file_optional(void *file, const H5VL_class_t *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 == cls->file_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'file optional' method") - - va_start (arguments, req); - if((ret_value = (cls->file_cls.optional)(file, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "optional failed") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_file_close - * - * Purpose: Closes a file through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_file_close(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(file); - HDassert(cls); - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->file_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'file close' method"); - - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->file_cls.close)(file, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "close failed"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_group_create - * - * Purpose: Creates a group through the VOL - * - * Return: Success: pointer to new group. - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) -{ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the corresponding VOL create callback exists */ - if(NULL == cls->group_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'group create' method") - - /* call the corresponding VOL create callback */ - if(NULL == (ret_value = (cls->group_cls.create) - (obj, loc_params, name, gcpl_id, gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_group_open - * - * Purpose: Opens a group through the VOL - * - * Return: Success: pointer to new group. - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t gapl_id, hid_t dxpl_id, void **req) -{ - void *ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - if(NULL == cls->group_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'group open' method") - - if(NULL == (ret_value = (cls->group_cls.open) - (obj, loc_params, name, gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_group_get - * - * Purpose: Get specific information about the group through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->group_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'group get' method") - - va_start (arguments, req); - if((ret_value = (cls->group_cls.get) - (obj, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_group_specific - * - * Purpose: specific operation on groups through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->group_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'group specific' method") - - va_start (arguments, req); - if((ret_value = (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); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_group_optional - * - * Purpose: optional operation specific to drivers. - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_group_optional(void *obj, const H5VL_class_t *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 == cls->group_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'group optional' method") - - va_start (arguments, req); - if((ret_value = (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); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_group_close - * - * Purpose: Closes a group through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_group_close(void *grp, const H5VL_class_t *cls, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; - - HDassert(grp); - HDassert(cls); - - FUNC_ENTER_NOAPI(FAIL) - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->group_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'group close' method"); - - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->group_cls.close)(grp, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed"); + /* Save the updated wrapper context */ + if(H5CX_set_vol_wrap_ctx(vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context") + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_close() */ +} /* end H5VL_reset_vol_wrapper() */ /*------------------------------------------------------------------------- - * Function: H5VL_link_create + * Function: H5VL_wrap_register * - * Purpose: Creates a hard link through the VOL + * Purpose: Wrap an object and register an ID for it * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED / FAIL * *------------------------------------------------------------------------- */ -herr_t -H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, - const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* check if the corresponding VOL create callback exists */ - if(NULL == cls->link_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link create' method") - /* call the corresponding VOL create callback */ - if((ret_value = (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") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_link_copy - * - * Purpose: Copys a link from src to dst. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, - hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* check if the corresponding VOL copy callback exists */ - if(NULL == cls->link_cls.copy) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link copy' method") - - /* call the corresponding VOL copy callback */ - if((ret_value = (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") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_link_move - * - * Purpose: Moves a link from src to dst. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, - hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* check if the corresponding VOL move callback exists */ - if(NULL == cls->link_cls.move) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link move' method") - - /* call the corresponding VOL move callback */ - if((ret_value = (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") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_move() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_link_get - * - * Purpose: Get specific information about the link through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_link_get_t get_type, - 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 == cls->link_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link get' method") - - va_start (arguments, req); - if((ret_value = (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); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_link_specific - * - * Purpose: specific operation on links through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, - H5VL_link_specific_t specific_type, 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 == cls->link_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link specific' method") - - va_start (arguments, req); - if((ret_value = (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); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_link_optional - * - * Purpose: optional operation specific to drivers. - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_link_optional(void *obj, const H5VL_class_t *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 == cls->link_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link optional' method") - - va_start (arguments, req); - if((ret_value = (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); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_object_open - * - * Purpose: Opens a object through the VOL - * - * Return: Success: User ID of the new object. - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_object_open(void *obj, H5VL_loc_params_t params, const H5VL_class_t *cls, H5I_type_t *opened_type, - hid_t dxpl_id, void **req) -{ - void *ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the corresponding VOL open callback exists */ - if(NULL == cls->object_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'object open' method") - - /* call the corresponding VOL open callback */ - if(NULL == (ret_value = (cls->object_cls.open) - (obj, params, opened_type, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_object_copy - * - * Purpose: Copies an object to another destination through the VOL - * - * Return: Success: Non Negative - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const H5VL_class_t *cls1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls2, const char *dst_name, - hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Make sure that the VOL drivers are the same */ - if (cls1->value != cls2->value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL drivers and can't be linked") - - if(NULL == cls1->object_cls.copy) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'object copy' method") - - if((ret_value = (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") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_object_get - * - * Purpose: Get specific information about the object through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_object_get_t get_type, - 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 == cls->object_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'object get' method") - - va_start (arguments, req); - if((ret_value = (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); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_object_specific - * - * Purpose: specific operation on objects through the VOL - * - * Return: Success: non negative - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, - H5VL_object_specific_t specific_type, 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 == cls->object_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'object specific' method") - - va_start (arguments, req); - if((ret_value = (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); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_object_optional - * - * Purpose: optional operation specific to drivers. - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_object_optional(void *obj, const H5VL_class_t *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 == cls->object_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'object optional' method") - - va_start (arguments, req); - if((ret_value = (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); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_commit - * - * Purpose: Commits a datatype to the file through the VOL - * - * Return: Success: Positive - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -void * -H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *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) -{ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the corresponding VOL commit callback exists */ - if(NULL == cls->datatype_cls.commit) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'datatype commit' method") - - /* call the corresponding VOL commit callback */ - if(NULL == (ret_value = (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") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_commit() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_open - * - * Purpose: Opens a named datatype through the VOL - * - * Return: Success: User ID of the datatype. - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t tapl_id, hid_t dxpl_id, void **req) -{ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the type specific corresponding VOL open callback exists */ - if(NULL == 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 = (cls->datatype_cls.open) - (obj, loc_params, name, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_get - * - * Purpose: Get specific information about the datatype through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type, - 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) - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->datatype_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'datatype get' method"); - va_start (arguments, req); - - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed"); - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_specific - * - * Purpose: specific operation on datatypes through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type, - 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 == cls->datatype_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'datatype specific' method") - - va_start (arguments, req); - if((ret_value = (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); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_optional - * - * Purpose: optional operation specific to drivers. - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_datatype_optional(void *obj, const H5VL_class_t *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 == cls->datatype_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'datatype optional' method") - - va_start (arguments, req); - if((ret_value = (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); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_close - * - * Purpose: Closes a datatype through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_datatype_close(void *dt, const H5VL_class_t *cls, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->datatype_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'datatype close' method"); - - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->datatype_cls.close)(dt, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_request_cancel - * - * Purpose: Cancels an asynchronous request through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_request_cancel(void **req, const H5VL_class_t *cls, H5ES_status_t *status) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(req); - HDassert(cls); - HDassert(status); - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->async_cls.cancel) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'async cancel' method"); - - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->async_cls.cancel)(req, status)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_request_cancel() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_request_test - * - * Purpose: Tests an asynchronous request through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_request_test(void **req, const H5VL_class_t *cls, H5ES_status_t *status) +hid_t +H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref) { - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(req); - HDassert(cls); - HDassert(status); - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->async_cls.test) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'async test' method"); + H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */ + void *new_obj; /* Newly wrapped object */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->async_cls.test)(req, status)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request test failed"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_request_test() */ + FUNC_ENTER_NOAPI(H5I_INVALID_HID) - -/*------------------------------------------------------------------------- - * Function: H5VL_request_wait - * - * Purpose: Waits on an asychronous request through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_request_wait(void **req, const H5VL_class_t *cls, H5ES_status_t *status) -{ - herr_t ret_value = SUCCEED; + /* Sanity check */ + HDassert(obj); - FUNC_ENTER_NOAPI(FAIL) + /* If the datatype is already VOL-managed, the datatype's vol_obj + * field will get clobbered later, so disallow this. + */ + if(type == H5I_DATATYPE) + if(TRUE == H5T_already_vol_managed((const H5T_t *)obj)) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can't wrap an uncommitted datatype") - HDassert(req); - HDassert(cls); - HDassert(status); + /* Wrap the object with VOL connector info */ + if(NULL == (new_obj = H5VL__wrap_obj(obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "can't wrap library object") - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->async_cls.wait) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'async wait' method"); + /* Retrieve the VOL object wrapping context */ + if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") + if(NULL == vol_wrap_ctx || NULL == vol_wrap_ctx->connector) + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "VOL object wrap context or its connector is NULL???") - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->async_cls.wait)(req, status)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed"); + /* Get an ID for the object */ + if((ret_value = H5VL_register_using_vol_id(type, new_obj, vol_wrap_ctx->connector->id, app_ref)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_request_wait() */ +} /* end H5VL_wrap_register() */ diff --git a/src/H5VLnative.c b/src/H5VLnative.c index e71e08e..bf847c5 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Purpose: The native VOL driver where access is to a single HDF5 file + * Purpose: The native VOL connector where access is to a single HDF5 file * using HDF5 VFDs. */ @@ -40,156 +40,165 @@ #include "H5Rpkg.h" /* References */ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5Tpkg.h" /* Datatypes */ -#include "H5VLprivate.h" /* VOL drivers */ -#include "H5VLnative_private.h" /* Native VOL driver */ +#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5VLnative_private.h" /* Native VOL connector */ /* - * The VOL driver identification number. + * The VOL connector identification number. */ static hid_t H5VL_NATIVE_ID_g = H5I_INVALID_HID; /* Prototypes */ -static H5F_t *H5VL_native_get_file(void *obj, H5I_type_t type); static herr_t H5VL__native_term(void); /* Atrribute callbacks */ -static void *H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); -static void *H5VL_native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t aapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); -static herr_t H5VL_native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); -static herr_t H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_attr_close(void *attr, hid_t dxpl_id, void **req); +static void *H5VL__native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t aapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_attr_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_attr_close(void *attr, hid_t dxpl_id, void **req); /* Dataset callbacks */ -static void *H5VL_native_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); -static void *H5VL_native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, +static void *H5VL__native_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); -static herr_t H5VL_native_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, +static herr_t H5VL__native_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); -static herr_t H5VL_native_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_dataset_specific(void *dset, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_dataset_optional(void *dset, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_dataset_close(void *dset, hid_t dxpl_id, void **req); +static herr_t H5VL__native_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_dataset_specific(void *dset, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_dataset_optional(void *dset, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_dataset_close(void *dset, hid_t dxpl_id, void **req); /* File callbacks */ -static void *H5VL_native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); -static void *H5VL_native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_file_optional(void *file, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_file_close(void *file, hid_t dxpl_id, void **req); +static void *H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_file_optional(void *file, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_file_close(void *file, hid_t dxpl_id, void **req); /* Group callbacks */ -static void *H5VL_native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); -static void *H5VL_native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_group_specific(void *dset, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_group_close(void *grp, hid_t dxpl_id, void **req); +static void *H5VL__native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_group_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_group_close(void *grp, hid_t dxpl_id, void **req); /* Link callbacks */ -static herr_t H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, +static herr_t H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, +static herr_t H5VL__native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, +static herr_t H5VL__native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); /* Object callbacks */ -static void *H5VL_native_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_native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, +static void *H5VL__native_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__native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_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); -static herr_t H5VL_native_object_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_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); +static herr_t H5VL__native_object_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); /* Datatype callbacks */ -static void *H5VL_native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, 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); -static void *H5VL_native_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_datatype_close(void *dt, hid_t dxpl_id, void **req); +static void *H5VL__native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, 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); +static void *H5VL__native_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_datatype_close(void *dt, hid_t dxpl_id, void **req); -/* Native VOL driver class struct */ +/* Native VOL connector class struct */ static H5VL_class_t H5VL_native_cls_g = { H5VL_NATIVE_VERSION, /* version */ H5VL_NATIVE_VALUE, /* value */ H5VL_NATIVE_NAME, /* name */ + 0, /* capability flags */ NULL, /* initialize */ - NULL, /* terminate */ - (size_t)0, /* fapl size */ - NULL, /* fapl copy */ - NULL, /* fapl free */ + H5VL__native_term, /* terminate */ + (size_t)0, /* info size */ + NULL, /* info copy */ + NULL, /* info compare */ + NULL, /* info free */ + NULL, /* get_object */ + NULL, /* get_wrap_ctx */ + NULL, /* free_wrap_ctx */ + NULL, /* wrap_object */ { /* attribute_cls */ - H5VL_native_attr_create, /* create */ - H5VL_native_attr_open, /* open */ - H5VL_native_attr_read, /* read */ - H5VL_native_attr_write, /* write */ - H5VL_native_attr_get, /* get */ - H5VL_native_attr_specific, /* specific */ - NULL, /* optional */ - H5VL_native_attr_close /* close */ + H5VL__native_attr_create, /* create */ + H5VL__native_attr_open, /* open */ + H5VL__native_attr_read, /* read */ + H5VL__native_attr_write, /* write */ + H5VL__native_attr_get, /* get */ + H5VL__native_attr_specific, /* specific */ + H5VL__native_attr_optional, /* optional */ + H5VL__native_attr_close /* close */ }, { /* dataset_cls */ - H5VL_native_dataset_create, /* create */ - H5VL_native_dataset_open, /* open */ - H5VL_native_dataset_read, /* read */ - H5VL_native_dataset_write, /* write */ - H5VL_native_dataset_get, /* get */ - H5VL_native_dataset_specific, /* specific */ - H5VL_native_dataset_optional, /* optional */ - H5VL_native_dataset_close /* close */ + H5VL__native_dataset_create, /* create */ + H5VL__native_dataset_open, /* open */ + H5VL__native_dataset_read, /* read */ + H5VL__native_dataset_write, /* write */ + H5VL__native_dataset_get, /* get */ + H5VL__native_dataset_specific, /* specific */ + H5VL__native_dataset_optional, /* optional */ + H5VL__native_dataset_close /* close */ }, { /* datatype_cls */ - H5VL_native_datatype_commit, /* commit */ - H5VL_native_datatype_open, /* open */ - H5VL_native_datatype_get, /* get */ - H5VL_native_datatype_specific, /* specific */ + H5VL__native_datatype_commit, /* commit */ + H5VL__native_datatype_open, /* open */ + H5VL__native_datatype_get, /* get */ + H5VL__native_datatype_specific, /* specific */ NULL, /* optional */ - H5VL_native_datatype_close /* close */ + H5VL__native_datatype_close /* close */ }, { /* file_cls */ - H5VL_native_file_create, /* create */ - H5VL_native_file_open, /* open */ - H5VL_native_file_get, /* get */ - H5VL_native_file_specific, /* specific */ - H5VL_native_file_optional, /* optional */ - H5VL_native_file_close /* close */ + H5VL__native_file_create, /* create */ + H5VL__native_file_open, /* open */ + H5VL__native_file_get, /* get */ + H5VL__native_file_specific, /* specific */ + H5VL__native_file_optional, /* optional */ + H5VL__native_file_close /* close */ }, { /* group_cls */ - H5VL_native_group_create, /* create */ - H5VL_native_group_open, /* open */ - H5VL_native_group_get, /* get */ - H5VL_native_group_specific, /* specific */ - NULL, /* optional */ - H5VL_native_group_close /* close */ + H5VL__native_group_create, /* create */ + H5VL__native_group_open, /* open */ + H5VL__native_group_get, /* get */ + H5VL__native_group_specific, /* specific */ + H5VL__native_group_optional, /* optional */ + H5VL__native_group_close /* close */ }, { /* link_cls */ - H5VL_native_link_create, /* create */ - H5VL_native_link_copy, /* copy */ - H5VL_native_link_move, /* move */ - H5VL_native_link_get, /* get */ - H5VL_native_link_specific, /* specific */ + H5VL__native_link_create, /* create */ + H5VL__native_link_copy, /* copy */ + H5VL__native_link_move, /* move */ + H5VL__native_link_get, /* get */ + H5VL__native_link_specific, /* specific */ NULL /* optional */ }, { /* object_cls */ - H5VL_native_object_open, /* open */ - H5VL_native_object_copy, /* copy */ - H5VL_native_object_get, /* get */ - H5VL_native_object_specific, /* specific */ - H5VL_native_object_optional /* optional */ + H5VL__native_object_open, /* open */ + H5VL__native_object_copy, /* copy */ + H5VL__native_object_get, /* get */ + H5VL__native_object_specific, /* specific */ + H5VL__native_object_optional /* optional */ }, - { /* async_cls */ + { /* request_cls */ + NULL, /* wait */ NULL, /* cancel */ - NULL, /* test */ - NULL /* wait */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* free */ }, NULL /* optional */ }; @@ -198,27 +207,25 @@ static H5VL_class_t H5VL_native_cls_g = { /*------------------------------------------------------------------------- * Function: H5VL_native_init * - * Purpose: Initialize this VOL driver by registering it with the + * Purpose: Initialize this VOL connector by registering it with the * library. * - * Return: Success: The ID for the native driver + * Return: Success: The ID for the native connector * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t -H5VL_native_init(void) +H5VL_native_init(hid_t vipl_id) { hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(H5I_INVALID_HID) - /* Register the native VOL driver, if it isn't already */ - if(NULL == H5I_object_verify(H5VL_NATIVE_ID_g, H5I_VOL)) { - if((H5VL_NATIVE_ID_g = H5VL_register_driver((const H5VL_class_t *)&H5VL_native_cls_g, - sizeof(H5VL_class_t), TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL driver") - } + /* Register the native VOL connector, if it isn't already */ + if(NULL == H5I_object_verify(H5VL_NATIVE_ID_g, H5I_VOL)) + if((H5VL_NATIVE_ID_g = H5VL_register_connector((const H5VL_class_t *)&H5VL_native_cls_g, TRUE, vipl_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL connector") /* Set return value */ ret_value = H5VL_NATIVE_ID_g; @@ -227,13 +234,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_native_init() */ -/* XXX (VOL_MERGE): TEMPORARY */ -hid_t -H5VL_native_get_driver_id(void) -{ - return H5VL_NATIVE_ID_g; -} - /*--------------------------------------------------------------------------- * Function: H5VL__native_term @@ -260,7 +260,7 @@ H5VL__native_term(void) * Function: H5Pset_fapl_native * * Purpose: Modify the file access property list to use the H5VL_NATIVE - * driver defined in this source file. + * connector defined in this source file. * * Return: SUCCEED/FAIL * @@ -285,157 +285,8 @@ done: } /* end H5Pset_fapl_native() */ -/*--------------------------------------------------------------------------- - * Function: H5VL_native_get_file - * - * Purpose: Utility routine to get file struct for an object via the - * native VOL driver. - * - * Returns: SUCCESS: A pointer to the H5F_t struct for the file - * associated with the object. - * FAILURE: NULL - * - *--------------------------------------------------------------------------- - */ -static H5F_t * -H5VL_native_get_file(void *obj, H5I_type_t type) -{ - H5F_t *ret_value = NULL; /* File pointer */ - H5O_loc_t *oloc = NULL; /* Object location for ID */ - - FUNC_ENTER_NOAPI_NOINIT - - switch(type) { - case H5I_FILE: - ret_value = (H5F_t *)obj; - break; - case H5I_GROUP: - { - H5G_t *grp; - grp = (H5G_t *)obj; - oloc = H5G_oloc(grp); - break; - } - case H5I_DATATYPE: - { - H5T_t *dt; - dt = (H5T_t *)obj; - oloc = H5T_oloc(dt); - break; - } - case H5I_DATASET: - { - H5D_t *dset; - dset = (H5D_t *)obj; - oloc = H5D_oloc(dset); - break; - } - - case H5I_ATTR: - { - H5A_t *attr; - attr = (H5A_t *)obj; - oloc = H5A_oloc(attr); - break; - } - case H5I_UNINIT: - case H5I_BADID: - case H5I_DATASPACE: - case H5I_REFERENCE: - case H5I_VFL: - case H5I_VOL: - case H5I_GENPROP_CLS: - case H5I_GENPROP_LST: - case H5I_ERROR_CLASS: - case H5I_ERROR_MSG: - case H5I_ERROR_STACK: - case H5I_NTYPES: - default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") - } - - if(!ret_value) { - if (!oloc) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "object is not assocated with a file") - ret_value = oloc->file; - } - if(!ret_value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "object is not associated with a file") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5VL_native_get_file */ - - -/*--------------------------------------------------------------------------- - * Function: H5VL_native_register - * - * Purpose: Utility routine to register an ID with the native VOL driver - * as an auxilary object. - * - * Returns: Success: An ID for the object - * Failure: H5I_INVALID_HID - * - *--------------------------------------------------------------------------- - */ -hid_t -H5VL_native_register(H5I_type_t type, const void *obj, hbool_t app_ref) -{ - hid_t ret_value = H5I_INVALID_HID; - - FUNC_ENTER_NOAPI_NOINIT - - HDassert(obj); - - /* If the datatype is already VOL-managed, the datatype's vol_obj - * field will get clobbered later, so disallow this. - */ - if(type == H5I_DATATYPE) - if(((H5T_t *)obj)->vol_obj != NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can only get an ID for an uncommitted datatype") - - /* Get an ID for the object */ - if((ret_value = H5VL_register_using_vol_id(type, obj, H5VL_NATIVE_ID_g, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_register() */ - - -/*--------------------------------------------------------------------------- - * Function: H5VL_native_unregister - * - * Purpose: Utility routine to decrement ref count on Native VOL driver - * objects. - * - * Returns: SUCCEED/FAIL - * - *--------------------------------------------------------------------------- - */ -herr_t -H5VL_native_unregister(hid_t obj_id) -{ - H5VL_object_t *vol_obj = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - /* get the driver pointer */ - if(NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid ID") - - /* free object */ - if(H5VL_free_object(vol_obj) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_unregister() */ - - /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_create + * Function: H5VL__native_attr_create * * Purpose: Creates an attribute on an object. * @@ -445,8 +296,9 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t acpl_id, - hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, + hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { H5G_loc_t loc; /* Object location */ H5G_loc_t obj_loc; /* Location used to open group */ @@ -458,7 +310,7 @@ H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *att H5A_t *attr = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get the plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id))) @@ -477,7 +329,7 @@ H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *att if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") - /* If this is a named datatype, get the driver pointer to the datatype */ + /* If this is a named datatype, get the connector's pointer to the datatype */ type = H5T_get_actual_type(dt); if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) @@ -488,27 +340,28 @@ H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *att /* Go do the real work for attaching the attribute to the dataset */ if(NULL == (attr = H5A__create(&loc, attr_name, type, space, acpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Acreate_by_name */ if(NULL == (attr = H5A__create_by_name(&loc, loc_params.loc_data.loc_by_name.name, attr_name, type, space, acpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") - } - else { + } /* end else-if */ + else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown attribute create parameters") - } + ret_value = (void *)attr; done: /* Release resources */ if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't free location") + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_create() */ +} /* end H5VL__native_attr_create() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_open + * Function: H5VL__native_attr_open * * Purpose: Opens a attr inside a native h5 file. * @@ -521,14 +374,14 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, - hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, + hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ void *ret_value; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) @@ -539,13 +392,13 @@ H5VL_native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_ /* Open the attribute */ if(NULL == (attr = H5A__open(&loc, attr_name))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute: '%s'", attr_name) - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Aopen_by_name */ /* Open the attribute on the object header */ if(NULL == (attr = H5A__open_by_name(&loc, loc_params.loc_data.loc_by_name.name, attr_name))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "can't open attribute") - } + } /* end else-if */ else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Aopen_by_idx */ /* Open the attribute in the object header */ @@ -554,20 +407,19 @@ H5VL_native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_ loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute") - } - else { + } /* end else-if */ + else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown attribute open parameters") - } ret_value = (void *)attr; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_open() */ +} /* end H5VL__native_attr_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_read + * Function: H5VL__native_attr_read * * Purpose: Reads in data from attribute. * @@ -579,26 +431,28 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5T_t *mem_type; /* Memory datatype */ herr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + /* Go write the actual data to the attribute */ if((ret_value = H5A__read((H5A_t*)attr, mem_type, buf)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_read() */ +} /* end H5VL__native_attr_read() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_write + * Function: H5VL__native_attr_write * * Purpose: Writes out data to attribute. * @@ -610,26 +464,28 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5T_t *mem_type; /* Memory datatype */ herr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + /* Go write the actual data to the attribute */ if((ret_value = H5A__write((H5A_t*)attr, mem_type, buf)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_write() */ +} /* end H5VL__native_attr_write() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_get + * Function: H5VL__native_attr_get * * Purpose: Gets certain information about an attribute * @@ -642,11 +498,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(get_type) { /* H5Aget_space */ @@ -659,6 +516,7 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute") break; } + /* H5Aget_type */ case H5VL_ATTR_GET_TYPE: { @@ -669,6 +527,7 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of attribute") break; } + /* H5Aget_create_plist */ case H5VL_ATTR_GET_ACPL: { @@ -680,6 +539,7 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d break; } + /* H5Aget_name */ case H5VL_ATTR_GET_NAME: { @@ -721,13 +581,14 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d /* Release resources */ if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") } else HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr") break; } + /* H5Aget_info */ case H5VL_ATTR_GET_INFO: { @@ -759,7 +620,7 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d /* Release resources */ if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") } else if(H5VL_OBJECT_BY_IDX == loc_params.type) { H5G_loc_t loc; @@ -781,13 +642,14 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d /* Release resources */ if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") } else HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr") break; } + case H5VL_ATTR_GET_STORAGE_SIZE: { hsize_t *ret = va_arg(arguments, hsize_t *); @@ -797,17 +659,18 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d *ret = attr->shared->data_size; break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from attr") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_get() */ +} /* end H5VL__native_attr_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_specific + * Function: H5VL__native_attr_specific * * Purpose: Specific operations for attributes * @@ -820,18 +683,17 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5G_loc_t loc; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get location for passed-in object */ if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - /* XXX: Do I need to clean this up? */ switch(specific_type) { case H5VL_ATTR_DELETE: @@ -843,24 +705,25 @@ H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_spe /* Delete the attribute from the location */ if(H5O__attr_remove(loc.oloc, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") - } + } /* end if */ else if(H5VL_OBJECT_BY_NAME == loc_params.type) { /* H5Adelete_by_name */ /* Delete the attribute */ if(H5A__delete_by_name(&loc, loc_params.loc_data.loc_by_name.name, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") - } + } /* end else-if */ else if(H5VL_OBJECT_BY_IDX == loc_params.type) { /* H5Adelete_by_idx */ /* Delete the attribute from the location */ if(H5A__delete_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") - } + } /* end else-if */ else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute remove parameters") break; } + case H5VL_ATTR_EXISTS: { const char *attr_name = va_arg(arguments, const char *); @@ -870,16 +733,17 @@ H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_spe /* Check if the attribute exists */ if((*ret = H5O__attr_exists(loc.oloc, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Aexists_by_name */ /* Check if the attribute exists */ if((*ret = H5A__exists_by_name(loc, loc_params.loc_data.loc_by_name.name, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") - } + } /* end else-if */ else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters") break; } + case H5VL_ATTR_ITER: { H5_index_t idx_type = va_arg(arguments, H5_index_t); @@ -889,21 +753,20 @@ H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_spe void *op_data = va_arg(arguments, void *); if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Aiterate2 */ - /* Iterate over attributes */ if((ret_value = H5A__iterate(&loc, ".", idx_type, order, idx, op, op_data)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Aiterate_by_name */ - /* Iterate over attributes by name */ if((ret_value = H5A__iterate(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order, idx, op, op_data)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "attribute iteration failed"); - } + } /* end else-if */ else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters") break; } + /* H5Arename/rename_by_name */ case H5VL_ATTR_RENAME: { @@ -914,26 +777,73 @@ H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_spe /* Call attribute rename routine */ if(H5O__attr_rename(loc.oloc, old_name, new_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Arename_by_name */ /* Call attribute rename routine */ if(H5A__rename_by_name(loc, loc_params.loc_data.loc_by_name.name, old_name, new_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - } + } /* end else-if */ else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute rename parameters") break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") - } + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_attr_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_attr_optional + * + * Purpose: Perform a connector-specific operation on a native attribute + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_attr_optional(void H5_ATTR_UNUSED *obj, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5VL_attr_optional_t optional_type; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + optional_type = va_arg(arguments, H5VL_attr_optional_t); + switch(optional_type) { +#ifndef H5_NO_DEPRECATED_SYMBOLS + case H5VL_ATTR_ITERATE_OLD: + { + hid_t loc_id = va_arg(arguments, hid_t); + unsigned *attr_num = va_arg(arguments, unsigned *); + H5A_operator1_t op = va_arg(arguments, H5A_operator1_t); + void *op_data = va_arg(arguments, void *); + + /* Call the actual iteration routine */ + if((ret_value = H5A__iterate_old(loc_id, attr_num, op, op_data)) < 0) + HERROR(H5E_VOL, H5E_BADITER, "error iterating over attributes"); + + break; + } +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") + } /* end switch */ + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_specific() */ +} /* end H5VL__native_attr_optional() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_close + * Function: H5VL__native_attr_close * * Purpose: Closes an attribute. * @@ -946,22 +856,22 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_attr_close(void *attr, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_attr_close(void *attr, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5A__close((H5A_t*)attr) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close attribute") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_close() */ +} /* end H5VL__native_attr_close() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_create + * Function: H5VL__native_dataset_create * * Purpose: Creates a dataset in a native HDF5 file * @@ -971,8 +881,9 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, - hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_dataset_create(void *obj, H5VL_loc_params_t loc_params, + const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { H5P_genplist_t *plist; /* Property list pointer */ H5G_loc_t loc; /* Object location to insert dataset into */ @@ -983,7 +894,7 @@ H5VL_native_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char * const H5S_t *space; /* Dataspace for dataset */ void *ret_value; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get the plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) @@ -1010,14 +921,14 @@ H5VL_native_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char * /* build and open the new dataset */ if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset") - } + } /* end if */ /* H5Dcreate2 */ else { /* Create the new dataset & get its ID */ - if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, - dcpl_id, dapl_id))) + if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset") - } + } /* end else */ + ret_value = (void *)dset; done: @@ -1033,14 +944,15 @@ done: /* Decrement refcount on dataset's object header in memory */ if(H5O_dec_rc_by_loc(oloc) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object") - } - } + } /* end if */ + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_create() */ +} /* end H5VL__native_dataset_create() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_open + * Function: H5VL__native_dataset_open * * Purpose: Opens a dataset in a native HDF5 file. * @@ -1050,14 +962,14 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, - hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5D_t *dset = NULL; H5G_loc_t loc; /* Object location of group */ void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") @@ -1070,11 +982,11 @@ H5VL_native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *na done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_open() */ +} /* end H5VL__native_dataset_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_read + * Function: H5VL__native_dataset_read * * Purpose: Reads raw data from a dataset into a buffer. * @@ -1083,15 +995,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, void *buf, void H5_ATTR_UNUSED **req) +H5VL__native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, void *buf, + void H5_ATTR_UNUSED **req) { H5D_t *dset = (H5D_t *)obj; const H5S_t *mem_space = NULL; const H5S_t *file_space = NULL; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ if(NULL == dset->oloc.file) @@ -1109,11 +1022,11 @@ H5VL_native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_read() */ +} /* end H5VL__native_dataset_read() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_write + * Function: H5VL__native_dataset_write * * Purpose: Writes raw data from a buffer into a dataset. * @@ -1122,15 +1035,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, const void *buf, void H5_ATTR_UNUSED **req) +H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, const void *buf, + void H5_ATTR_UNUSED **req) { H5D_t *dset = (H5D_t *)obj; const H5S_t *mem_space = NULL; const H5S_t *file_space = NULL; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ if(NULL == dset->oloc.file) @@ -1148,11 +1062,11 @@ H5VL_native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_write() */ +} /* end H5VL__native_dataset_write() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_get + * Function: H5VL__native_dataset_get * * Purpose: Gets certain information about a dataset * @@ -1161,13 +1075,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id, - void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_dataset_get(void *obj, H5VL_dataset_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5D_t *dset = (H5D_t *)obj; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(get_type) { /* H5Dget_space */ @@ -1180,7 +1094,8 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN break; } - /* H5Dget_space_statuc */ + + /* H5Dget_space_statuc */ case H5VL_DATASET_GET_SPACE_STATUS: { H5D_space_status_t *allocation = va_arg(arguments, H5D_space_status_t *); @@ -1191,7 +1106,8 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN break; } - /* H5Dget_type */ + + /* H5Dget_type */ case H5VL_DATASET_GET_TYPE: { hid_t *ret_id = va_arg(arguments, hid_t *); @@ -1201,7 +1117,8 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN break; } - /* H5Dget_create_plist */ + + /* H5Dget_create_plist */ case H5VL_DATASET_GET_DCPL: { hid_t *ret_id = va_arg(arguments, hid_t *); @@ -1211,7 +1128,8 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN break; } - /* H5Dget_access_plist */ + + /* H5Dget_access_plist */ case H5VL_DATASET_GET_DAPL: { hid_t *ret_id = va_arg(arguments, hid_t *); @@ -1221,7 +1139,8 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN break; } - /* H5Dget_storage_size */ + + /* H5Dget_storage_size */ case H5VL_DATASET_GET_STORAGE_SIZE: { hsize_t *ret = va_arg(arguments, hsize_t *); @@ -1231,7 +1150,8 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage") break; } - /* H5Dget_offset */ + + /* H5Dget_offset */ case H5VL_DATASET_GET_OFFSET: { haddr_t *ret = va_arg(arguments, haddr_t *); @@ -1242,17 +1162,18 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN *ret = HADDR_UNDEF; break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from dataset") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_get() */ +} /* end H5VL__native_dataset_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_specific + * Function: H5VL__native_dataset_specific * * Purpose: Specific operations for datasets * @@ -1261,13 +1182,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5D_t *dset = (H5D_t *)obj; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(specific_type) { /* H5Dspecific_space */ @@ -1279,6 +1200,7 @@ H5VL_native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extent of dataset") break; } + case H5VL_DATASET_FLUSH: { hid_t dset_id = va_arg(arguments, hid_t); @@ -1289,6 +1211,7 @@ H5VL_native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, break; } + case H5VL_DATASET_REFRESH: { hid_t dset_id = va_arg(arguments, hid_t); @@ -1299,32 +1222,34 @@ H5VL_native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_specific() */ +} /* end H5VL__native_dataset_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_optional + * Function: H5VL__native_dataset_optional * - * Purpose: Perform a driver specific operation on a native dataset + * Purpose: Perform a connector-specific operation on a native dataset * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t -H5VL_native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req, va_list arguments) { H5D_t *dset = NULL; /* Dataset */ H5VL_dataset_optional_t optional_type = va_arg(arguments, H5VL_dataset_optional_t); herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(optional_type) { case H5VL_DATASET_FORMAT_CONVERT: @@ -1361,6 +1286,7 @@ H5VL_native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_AT break; } + case H5VL_DATASET_GET_CHUNK_INDEX_TYPE: { H5D_chunk_index_t *idx_type = va_arg(arguments, H5D_chunk_index_t *); @@ -1376,6 +1302,7 @@ H5VL_native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_AT break; } + case H5VL_DATASET_GET_CHUNK_STORAGE_SIZE: { hsize_t *offset = va_arg(arguments, hsize_t *); @@ -1393,6 +1320,7 @@ H5VL_native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_AT break; } + case H5VL_DATASET_CHUNK_READ: { const hsize_t *offset = va_arg(arguments, hsize_t *); @@ -1420,6 +1348,7 @@ H5VL_native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_AT break; } + case H5VL_DATASET_CHUNK_WRITE: { uint32_t filters = va_arg(arguments, uint32_t); @@ -1448,17 +1377,18 @@ H5VL_native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_AT break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_optional() */ +} /* end H5VL__native_dataset_optional() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_close + * Function: H5VL__native_dataset_close * * Purpose: Closes a dataset. * @@ -1468,22 +1398,23 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_dataset_close(void *dset, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_dataset_close(void *dset, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5D_close((H5D_t*)dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close dataset") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_close() */ +} /* end H5VL__native_dataset_close() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_file_create + * Function: H5VL__native_file_create * * Purpose: Creates a file as a native HDF5 file. * @@ -1494,13 +1425,13 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5F_t *new_file = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Adjust bit flags by turning on the creation bit and making sure that * the EXCL or TRUNC bit is set. All newly-created files are opened for @@ -1513,20 +1444,21 @@ H5VL_native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t f /* Create the file */ if(NULL == (new_file = H5F_open(name, flags, fcpl_id, fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create file") - new_file->id_exists = TRUE; + ret_value = (void *)new_file; done: if(NULL == ret_value && new_file) if(H5F__close(new_file) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file") + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_file_create() */ +} /* end H5VL__native_file_create() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_file_open + * Function: H5VL__native_file_open * * Purpose: Opens a file as a native HDF5 file. * @@ -1537,29 +1469,31 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5F_t *new_file = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Open the file */ if(NULL == (new_file = H5F_open(name, flags, H5P_FILE_CREATE_DEFAULT, fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") - new_file->id_exists = TRUE; + ret_value = (void *)new_file; done: if(NULL == ret_value && new_file && H5F_try_close(new_file, NULL) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file") + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_file_open() */ +} /* end H5VL__native_file_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_file_get + * Function: H5VL__native_file_get * * Purpose: Gets certain data about a file * @@ -1568,12 +1502,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5F_t *f = NULL; /* File struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(get_type) { /* H5Fget_access_plist */ @@ -1592,6 +1527,7 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") break; } + /* H5Fget_create_plist */ case H5VL_FILE_GET_FCPL: { @@ -1608,6 +1544,7 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d break; } + /* H5Fget_obj_count */ case H5VL_FILE_GET_OBJ_COUNT: { @@ -1624,6 +1561,7 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d *ret = (ssize_t)obj_count; break; } + /* H5Fget_obj_ids */ case H5VL_FILE_GET_OBJ_IDS: { @@ -1642,6 +1580,7 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d *ret = (ssize_t)obj_count; break; } + /* H5Fget_intent */ case H5VL_FILE_GET_INTENT: { @@ -1659,17 +1598,18 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d /* Check for SWMR write access on the file */ if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) *intent_flags |= H5F_ACC_SWMR_WRITE; - } + } /* end if */ else { *intent_flags = H5F_ACC_RDONLY; /* Check for SWMR read access on the file */ if(H5F_INTENT(f) & H5F_ACC_SWMR_READ) *intent_flags |= H5F_ACC_SWMR_READ; - } + } /* end else */ break; } + /* H5Fget_name */ case H5VL_FILE_GET_NAME: { @@ -1679,7 +1619,7 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d ssize_t *ret = va_arg(arguments, ssize_t *); size_t len; - if(NULL == (f = H5VL_native_get_file(obj, type))) + if(NULL == (f = H5F__get_file(obj, type))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") len = HDstrlen(H5F_OPEN_NAME(f)); @@ -1688,34 +1628,24 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d HDstrncpy(name, H5F_OPEN_NAME(f), MIN(len + 1,size)); if(len >= size) name[size-1]='\0'; - } + } /* end if */ /* Set the return value for the API call */ *ret = (ssize_t)len; break; } - /* H5Iget_file_id */ - case H5VL_OBJECT_GET_FILE: - { - H5I_type_t type = va_arg(arguments, H5I_type_t); - void **ret = va_arg(arguments, void **); - if(NULL == (f = H5VL_native_get_file(obj, type))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - f->id_exists = TRUE; - *ret = (void*)f; - break; - } default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information") } /* end switch */ + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_file_get() */ +} /* end H5VL__native_file_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_file_specific + * Function: H5VL__native_file_specific * * Purpose: Perform an operation * @@ -1724,12 +1654,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id, - void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(specific_type) { /* H5Fflush */ @@ -1740,7 +1670,7 @@ H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H H5F_t *f = NULL; /* File to flush */ /* Get the file for the object */ - if(NULL == (f = H5VL_native_get_file(obj, type))) + if(NULL == (f = H5F__get_file(obj, type))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Nothing to do if the file is read only. This determination is @@ -1764,6 +1694,22 @@ H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H } break; } + + /* H5Freopen */ + case H5VL_FILE_REOPEN: + { + void **ret = va_arg(arguments, void **); + H5F_t *new_file = NULL; + + /* Reopen the file through the VOL connector */ + if(NULL == (new_file = H5F__reopen((H5F_t *)obj))) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") + new_file->id_exists = TRUE; + + *ret = (void *)new_file; + break; + } + /* H5Fmount */ case H5VL_FILE_MOUNT: { @@ -1782,6 +1728,7 @@ H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H break; } + /* H5Funmount */ case H5VL_FILE_UNMOUNT: { @@ -1798,6 +1745,7 @@ H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H break; } + /* H5Fis_accessible */ case H5VL_FILE_IS_ACCESSIBLE: { @@ -1810,33 +1758,35 @@ H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "error in HDF5 file check") break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_file_specific() */ +} /* end H5VL__native_file_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_file_optional + * Function: H5VL__native_file_optional * - * Purpose: Perform a driver specific operation on a native file + * Purpose: Perform a connector-specific operation on a native file * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t -H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5F_t *f = NULL; /* File */ H5VL_file_optional_t optional_type = va_arg(arguments, H5VL_file_optional_t); herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC + f = (H5F_t *)obj; switch(optional_type) { /* H5Fget_filesize */ case H5VL_FILE_GET_SIZE: @@ -1845,8 +1795,6 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ haddr_t base_addr; /* Base address for the file */ hsize_t *size = va_arg(arguments, hsize_t *); - f = (H5F_t *)obj; - /* Go get the actual file size */ if(H5F__get_max_eof_eoa(f, &max_eof_eoa) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") @@ -1858,6 +1806,7 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ break; } + /* H5Fget_file_image */ case H5VL_FILE_GET_FILE_IMAGE: { @@ -1865,25 +1814,25 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ ssize_t *ret = va_arg(arguments, ssize_t *); size_t buf_len = va_arg(arguments, size_t ); - f = (H5F_t *)obj; /* Do the actual work */ if((*ret = H5F__get_file_image(f, buf_ptr, buf_len)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get file image failed") break; } + /* H5Fget_freespace */ case H5VL_FILE_GET_FREE_SPACE: { hsize_t tot_space; /* Amount of free space in the file */ hssize_t *ret = va_arg(arguments, hssize_t *); - f = (H5F_t *)obj; /* Go get the actual amount of free space in the file */ if(H5MF_get_freespace(f, &tot_space, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") *ret = (hssize_t)tot_space; break; } + case H5VL_FILE_GET_FREE_SECTIONS: { H5F_sect_info_t *sect_info = va_arg(arguments, H5F_sect_info_t *); @@ -1891,12 +1840,12 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ H5F_mem_t type = va_arg(arguments, H5F_mem_t); size_t nsects = va_arg(arguments, size_t); - f = (H5F_t *)obj; /* Go get the free-space section information in the file */ if((*ret = H5MF_get_free_sections(f, type, nsects, sect_info)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") break; } + /* H5Fget_info2 */ case H5VL_FILE_GET_INFO: { @@ -1906,7 +1855,7 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ /* Get the file struct. This call is careful to not return the file pointer * for the top file in a mount hierarchy. */ - if(NULL == (f = H5VL_native_get_file(obj, type))) + if(NULL == (f = H5F__get_file(obj, type))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get a file struct") /* Get the file info */ @@ -1915,28 +1864,29 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ break; } + /* H5Fget_mdc_config */ case H5VL_FILE_GET_MDC_CONF: { H5AC_cache_config_t *config_ptr = va_arg(arguments, H5AC_cache_config_t *); - f = (H5F_t *)obj; /* Go get the resize configuration */ if(H5AC_get_cache_auto_resize_config(f->shared->cache, config_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.") break; } + /* H5Fget_mdc_hit_rate */ case H5VL_FILE_GET_MDC_HR: { double *hit_rate_ptr = va_arg(arguments, double *); - f = (H5F_t *)obj; /* Go get the current hit rate */ if(H5AC_get_cache_hit_rate(f->shared->cache, hit_rate_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.") break; } + /* H5Fget_mdc_size */ case H5VL_FILE_GET_MDC_SIZE: { @@ -1946,7 +1896,6 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ int *cur_num_entries_ptr = va_arg(arguments, int *); uint32_t cur_num_entries; - f = (H5F_t *)obj; /* Go get the size data */ if(H5AC_get_cache_size(f->shared->cache, max_size_ptr, min_clean_size_ptr, cur_size_ptr, &cur_num_entries) < 0) @@ -1956,138 +1905,120 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ *cur_num_entries_ptr = (int)cur_num_entries; break; } + /* H5Fget_vfd_handle */ case H5VL_FILE_GET_VFD_HANDLE: { void **file_handle = va_arg(arguments, void **); hid_t fapl_id = va_arg(arguments, hid_t); - f = (H5F_t *)obj; - /* Retrieve the VFD handle for the file */ if(H5F_get_vfd_handle(f, fapl_id, file_handle) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle") break; } + + /* H5Iget_file_id */ + case H5VL_FILE_GET_FILE_ID: + { + H5I_type_t type = va_arg(arguments, H5I_type_t); + hid_t *file_id = va_arg(arguments, hid_t *); + + if(NULL == (f = H5F__get_file(obj, type))) + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file or file object") + if((*file_id = H5F__get_file_id(f)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file ID") + break; + } + /* H5Fclear_elink_file_cache */ case H5VL_FILE_CLEAR_ELINK_CACHE: { - f = (H5F_t *)obj; - /* Release the EFC */ if(f->shared->efc) if(H5F__efc_release(f->shared->efc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") break; } - /* H5Freopen */ - case H5VL_FILE_REOPEN: - { - void **ret = va_arg(arguments, void **); - H5F_t *new_file = NULL; - - f = (H5F_t *)obj; - - /* Reopen the file through the VOL driver */ - if(NULL == (new_file = H5F__reopen(f))) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") - - new_file->id_exists = TRUE; - *ret = (void *)new_file; - break; - } /* H5Freset_mdc_hit_rate_stats */ case H5VL_FILE_RESET_MDC_HIT_RATE: { - f = (H5F_t *)obj; /* Reset the hit rate statistic */ if(H5AC_reset_cache_hit_rate_stats(f->shared->cache) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate") break; } + case H5VL_FILE_SET_MDC_CONFIG: { H5AC_cache_config_t *config_ptr = va_arg(arguments, H5AC_cache_config_t *); - f = (H5F_t *)obj; /* set the resize configuration */ if(H5AC_set_cache_auto_resize_config(f->shared->cache, config_ptr) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed") break; } + case H5VL_FILE_GET_METADATA_READ_RETRY_INFO: { H5F_retry_info_t *info = va_arg(arguments, H5F_retry_info_t *); - f = (H5F_t *)obj; - if(H5F_get_metadata_read_retry_info(f, info) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't get metadata read retry info") break; } + case H5VL_FILE_START_SWMR_WRITE: { - f = (H5F_t *)obj; - if(H5F__start_swmr_write(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't start SWMR write") break; } + case H5VL_FILE_START_MDC_LOGGING: { - f = (H5F_t *)obj; - /* Call mdc logging function */ if(H5C_start_logging(f->shared->cache) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to start mdc logging") break; } + case H5VL_FILE_STOP_MDC_LOGGING: { - f = (H5F_t *)obj; - /* Call mdc logging function */ if(H5C_stop_logging(f->shared->cache) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging") break; } + case H5VL_FILE_GET_MDC_LOGGING_STATUS: { hbool_t *is_enabled = va_arg(arguments, hbool_t *); hbool_t *is_currently_logging = va_arg(arguments, hbool_t *); - f = (H5F_t *)obj; - /* Call mdc logging function */ if(H5C_get_logging_status(f->shared->cache, is_enabled, is_currently_logging) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status") break; } - case H5VL_FILE_SET_LATEST_FORMAT: - { - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") - break; - } + case H5VL_FILE_FORMAT_CONVERT: { - f = (H5F_t *)obj; - /* Convert the format */ if(H5F__format_convert(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format") break; } + case H5VL_FILE_RESET_PAGE_BUFFERING_STATS: { - f = (H5F_t *)obj; - /* Sanity check */ if(NULL == f->shared->page_buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file") @@ -2098,6 +2029,7 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ break; } + case H5VL_FILE_GET_PAGE_BUFFERING_STATS: { unsigned *accesses = va_arg(arguments, unsigned *); @@ -2106,8 +2038,6 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ unsigned *evictions = va_arg(arguments, unsigned *); unsigned *bypasses = va_arg(arguments, unsigned *); - f = (H5F_t *)obj; - /* Sanity check */ if(NULL == f->shared->page_buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file") @@ -2118,23 +2048,87 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ break; } + case H5VL_FILE_GET_MDC_IMAGE_INFO: { - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") + haddr_t *image_addr = va_arg(arguments, haddr_t *); + hsize_t *image_len = va_arg(arguments, hsize_t *); + + /* Go get the address and size of the cache image */ + if(H5AC_get_mdc_image_info(f->shared->cache, image_addr, image_len) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info") + + break; + } + + case H5VL_FILE_GET_EOA: + { + haddr_t *eoa = va_arg(arguments, haddr_t *); + haddr_t rel_eoa; /* Relative address of EOA */ + + /* Sanity check */ + HDassert(eoa); + + /* This routine will work only for drivers with this feature enabled.*/ + /* We might introduce a new feature flag in the future */ + if(!H5F_HAS_FEATURE(f, H5FD_FEAT_SUPPORTS_SWMR_IO)) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine") + + /* The real work */ + if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get_eoa request failed") + + /* Set return value */ + /* (Note compensating for base address subtraction in internal routine) */ + *eoa = rel_eoa + H5F_get_base_addr(f); + + break; + } + + case H5VL_FILE_INCR_FILESIZE: + { + hsize_t increment = va_arg(arguments, hsize_t); + haddr_t max_eof_eoa; /* Maximum of the relative EOA & EOF */ + + /* This public routine will work only for drivers with this feature enabled.*/ + /* We might introduce a new feature flag in the future */ + if(!H5F_HAS_FEATURE(f, H5FD_FEAT_SUPPORTS_SWMR_IO)) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine") + + /* Get the maximum of EOA and EOF */ + if(H5F__get_max_eof_eoa(f, &max_eof_eoa) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") + + /* Set EOA to the maximum value + increment */ + if(H5F__set_eoa(f, H5FD_MEM_DEFAULT, max_eof_eoa + increment) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed") + + break; + } + + case H5VL_FILE_SET_LIBVER_BOUNDS: + { + H5F_libver_t low = va_arg(arguments, H5F_libver_t); + H5F_libver_t high = va_arg(arguments, H5F_libver_t); + + /* Call internal set_libver_bounds function */ + if(H5F__set_libver_bounds(f, low, high) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds") + break; } default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_file_optional() */ +} /* end H5VL__native_file_optional() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_file_close + * Function: H5VL__native_file_close * * Purpose: Closes a file. * @@ -2143,14 +2137,15 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { int nref; H5F_t *f = (H5F_t *)file; hid_t file_id = H5I_INVALID_HID; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* This routine should only be called when a file ID's ref count drops to zero */ HDassert(H5F_ID_EXISTS(f)); @@ -2164,13 +2159,14 @@ H5VL_native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UN /* Get the file ID corresponding to the H5F_t struct */ if(H5I_find_id(f, H5I_FILE, &file_id) < 0 || H5I_INVALID_HID == file_id) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "invalid atom") + /* Get the number of references outstanding for this file ID */ if((nref = H5I_get_ref(file_id, FALSE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID ref count") if(nref == 1) if(H5F__flush(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") - } + } /* end if */ /* Close the file */ if(H5F__close(f) < 0) @@ -2178,11 +2174,11 @@ H5VL_native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UN done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_file_close() */ +} /* end H5VL__native_file_close() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_group_create + * Function: H5VL__native_group_create * * Purpose: Creates a group inside a native h5 file. * @@ -2193,8 +2189,9 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, - hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t gcpl_id, hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { H5P_genplist_t *plist; /* Property list pointer */ H5G_loc_t loc; /* Location to create group */ @@ -2202,7 +2199,7 @@ H5VL_native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *na hid_t lcpl_id; void *ret_value; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get the property list structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id))) @@ -2228,13 +2225,14 @@ H5VL_native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *na /* Create the new group & get its ID */ if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group") - } + } /* end if */ /* otherwise it's from H5Gcreate */ else { /* Create the new group & get its ID */ if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group") - } + } /* end else */ + ret_value = (void *)grp; done: @@ -2250,14 +2248,15 @@ done: /* Decrement refcount on group's object header in memory */ if(H5O_dec_rc_by_loc(oloc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object") - } - } + } /* end if */ + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_group_create() */ +} /* end H5VL__native_group_create() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_group_open + * Function: H5VL__native_group_open * * Purpose: Opens a group inside a native h5 file. * @@ -2268,14 +2267,14 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name, - hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5G_loc_t loc; /* Location to open group */ H5G_t *grp = NULL; /* New group opend */ void *ret_value; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Set up the location */ if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) @@ -2289,11 +2288,11 @@ H5VL_native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_group_open() */ +} /* end H5VL__native_group_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_group_get + * Function: H5VL__native_group_get * * Purpose: Gets data about a group * @@ -2302,11 +2301,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(get_type) { /* H5Gget_create_plist */ @@ -2319,6 +2319,7 @@ H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t H5_ATTR_UNUSED HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for group") break; } + /* H5Gget_info */ case H5VL_GROUP_GET_INFO: { @@ -2335,14 +2336,14 @@ H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t H5_ATTR_UNUSED /* Retrieve the group's information */ if(H5G__obj_info(loc.oloc, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") - } + } /* end if */ else if (loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Gget_info_by_name */ /* Retrieve the group's information */ if(H5G__get_info_by_name(&loc, loc_params.loc_data.loc_by_name.name, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") - } + } /* end else-if */ else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Gget_info_by_idx */ @@ -2350,23 +2351,23 @@ H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t H5_ATTR_UNUSED if(H5G__get_info_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") - } - else { + } /* end else-if */ + else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") - } break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from group") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_group_get() */ +} /* end H5VL__native_group_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_group_specific + * Function: H5VL__native_group_specific * * Purpose: Specific operations for groups * @@ -2375,13 +2376,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_group_specific(void *obj, H5VL_group_specific_t specific_type, +H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5G_t *grp = (H5G_t *)obj; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(specific_type) { case H5VL_GROUP_FLUSH: @@ -2394,6 +2395,7 @@ H5VL_native_group_specific(void *obj, H5VL_group_specific_t specific_type, break; } + case H5VL_GROUP_REFRESH: { hid_t group_id = va_arg(arguments, hid_t); @@ -2404,17 +2406,89 @@ H5VL_native_group_specific(void *obj, H5VL_group_specific_t specific_type, break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_group_specific() */ +} /* end H5VL__native_group_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_group_close + * Function: H5VL__native_group_optional + * + * Purpose: Perform a connector-specific operation on a native group + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_group_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req, va_list arguments) +{ + H5VL_group_optional_t optional_type; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + optional_type = va_arg(arguments, H5VL_group_optional_t); + switch(optional_type) { +#ifndef H5_NO_DEPRECATED_SYMBOLS + /* H5Giterate (deprecated) */ + case H5VL_GROUP_ITERATE_OLD: + { + H5VL_loc_params_t loc_params = va_arg(arguments, H5VL_loc_params_t); + hsize_t idx = va_arg(arguments, hsize_t); + hsize_t *last_obj = va_arg(arguments, hsize_t *); + const H5G_link_iterate_t *lnk_op = va_arg(arguments, const H5G_link_iterate_t *); + void *op_data = va_arg(arguments, void *); + H5G_loc_t grp_loc; + + /* Get the location struct for the object */ + if(H5G_loc_real(obj, loc_params.obj_type, &grp_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Call the actual iteration routine */ + if((ret_value = H5G_iterate(&grp_loc, loc_params.loc_data.loc_by_name.name, H5_INDEX_NAME, H5_ITER_INC, idx, last_obj, lnk_op, op_data)) < 0) + HERROR(H5E_VOL, H5E_BADITER, "error iterating over group's links"); + + break; + } + + /* H5Gget_objinfo (deprecated) */ + case H5VL_GROUP_GET_OBJINFO: + { + H5VL_loc_params_t loc_params = va_arg(arguments, H5VL_loc_params_t); + hbool_t follow_link = va_arg(arguments, unsigned); + H5G_stat_t *statbuf = va_arg(arguments, H5G_stat_t *); + H5G_loc_t grp_loc; + + /* Get the location struct for the object */ + if(H5G_loc_real(obj, loc_params.obj_type, &grp_loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Call the actual group objinfo routine */ + if(H5G__get_objinfo(&grp_loc, loc_params.loc_data.loc_by_name.name, follow_link, statbuf) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object") + + break; + } +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_group_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__native_group_close * * Purpose: Closes a group. * @@ -2423,22 +2497,22 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_group_close(void *grp, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_group_close(void *grp, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_close((H5G_t *)grp) < 0) HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close group") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_group_close() */ +} /* end H5VL__native_group_close() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_link_create + * Function: H5VL__native_link_create * * Purpose: Creates an hard/soft/UD/external links. * @@ -2450,13 +2524,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, - hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, + H5VL_loc_params_t loc_params, hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get the plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) @@ -2498,14 +2573,15 @@ H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc if((ret_value = H5L_create_hard(cur_loc_p, cur_params.loc_data.loc_by_name.name, link_loc_p, loc_params.loc_data.loc_by_name.name, lcpl_id)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") - } + } /* end if */ else { /* H5Olink */ /* Link to the object */ if(H5L_link(&link_loc, loc_params.loc_data.loc_by_name.name, &cur_loc, lcpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link") - } + } /* end else */ break; } + case H5VL_LINK_CREATE_SOFT: { char *target_name; @@ -2522,6 +2598,7 @@ H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") break; } + case H5VL_LINK_CREATE_UD: { H5G_loc_t link_loc; /* Group location for new link */ @@ -2545,16 +2622,18 @@ H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") break; } + default: HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "invalid link creation call") - } + } /* end switch */ + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_link_create() */ +} /* end H5VL__native_link_create() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_link_copy + * Function: H5VL__native_link_copy * * Purpose: Renames an object within an HDF5 file and copies it to a new * group. The original name SRC is unlinked from the group graph @@ -2571,15 +2650,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, - hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, + hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(NULL != src_obj && H5G_loc_real(src_obj, loc_params1.obj_type, &src_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") @@ -2602,11 +2682,11 @@ H5VL_native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_link_copy() */ +} /* end H5VL__native_link_copy() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_link_move + * Function: H5VL__native_link_move * * Purpose: Renames an object within an HDF5 file and moves it to a new * group. The original name SRC is unlinked from the group graph @@ -2623,15 +2703,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, - hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, + hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(NULL != src_obj && H5G_loc_real(src_obj, loc_params1.obj_type, &src_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") @@ -2654,11 +2735,11 @@ H5VL_native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_link_move() */ +} /* end H5VL__native_link_move() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_link_get + * Function: H5VL__native_link_get * * Purpose: Gets certain data about a link * @@ -2671,13 +2752,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5G_loc_t loc; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") @@ -2692,17 +2773,17 @@ H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t ge if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Lget_info */ if(H5L_get_info(&loc, loc_params.loc_data.loc_by_name.name, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Lget_info_by_idx */ - if(H5L_get_info_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") - } + } /* end else-if */ else HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") break; } + /* H5Lget_name_by_idx */ case H5VL_LINK_GET_NAME: { @@ -2717,6 +2798,7 @@ H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t ge break; } + /* H5Lget_val/H5Lget_val_by_idx */ case H5VL_LINK_GET_VAL: { @@ -2739,17 +2821,18 @@ H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t ge break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from link") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_link_get() */ +} /* end H5VL__native_link_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_link_specific + * Function: H5VL__native_link_specific * * Purpose: Specific operations with links * @@ -2762,12 +2845,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(specific_type) { case H5VL_LINK_EXISTS: @@ -2783,6 +2866,7 @@ H5VL_native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_spe HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to specific link info") break; } + case H5VL_LINK_ITER: { H5G_loc_t loc; @@ -2803,31 +2887,31 @@ H5VL_native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_spe /* H5Lvisit */ if((ret_value = H5G_visit(&loc, ".", idx_type, order, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") - } + } /* end if */ else { /* H5Literate */ if((ret_value = H5L_iterate(&loc, ".", idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links") - } - } + } /* end else */ + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { if(recursive) { /* H5Lvisit_by_name */ if((ret_value = H5G_visit(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") - } + } /* end if */ else { /* H5Literate_by_name */ if((ret_value = H5L_iterate(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links") - } - } - else{ + } /* end else */ + } /* end else-if */ + else HGOTO_ERROR(H5E_LINK, H5E_UNSUPPORTED, FAIL, "unknown link iterate params") - } break; } + case H5VL_LINK_DELETE: { H5G_loc_t loc; @@ -2839,28 +2923,28 @@ H5VL_native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_spe if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Ldelete */ if(H5L_delete(&loc, loc_params.loc_data.loc_by_name.name) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Ldelete_by_idx */ - if(H5L_delete_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") - } + } /* end else-if */ else HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_link_specific() */ +} /* end H5VL__native_link_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_object_open + * Function: H5VL__native_object_open * * Purpose: Opens a object inside a native h5 file. * @@ -2873,13 +2957,13 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5G_loc_t loc; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") @@ -2892,6 +2976,7 @@ H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *ope HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by name") break; } + case H5VL_OBJECT_BY_IDX: { /* Open the object */ @@ -2900,6 +2985,7 @@ H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *ope HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by index") break; } + case H5VL_OBJECT_BY_ADDR: { /* Open the object */ @@ -2907,6 +2993,7 @@ H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *ope HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by address") break; } + case H5VL_OBJECT_BY_REF: { hid_t temp_id = H5I_INVALID_HID; @@ -2923,21 +3010,22 @@ H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *ope *opened_type = H5I_get_type(temp_id); if(NULL == (ret_value = H5I_remove(temp_id))) - HDONE_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open object") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open object") break; } + case H5VL_OBJECT_BY_SELF: default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown open parameters") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_open() */ +} /* end H5VL__native_object_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_object_copy + * Function: H5VL__native_object_copy * * Purpose: Copys a object inside a native h5 file. * @@ -2950,15 +3038,15 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name, - hid_t ocpypl_id, hid_t lcpl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name, + hid_t ocpypl_id, hid_t lcpl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5G_loc_t src_loc; /* Source object group location */ H5G_loc_t dst_loc; /* Destination group location */ herr_t ret_value = FAIL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* get location for objects */ if(H5G_loc_real(src_obj, loc_params1.obj_type, &src_loc) < 0) @@ -2966,16 +3054,17 @@ H5VL_native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char if(H5G_loc_real(dst_obj, loc_params2.obj_type, &dst_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - /* Open the object */ + /* Copy the object */ if((ret_value = H5O_copy(&src_loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "unable to copy object") + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_copy() */ +} /* end H5VL__native_object_copy() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_object_get + * Function: H5VL__native_object_get * * Purpose: Gets certain data about an object * @@ -2987,13 +3076,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ H5G_loc_t loc; /* Location of group */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") @@ -3017,6 +3106,7 @@ H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_ break; } + /* H5Rget_obj_type2 */ case H5VL_REF_GET_TYPE: { @@ -3029,6 +3119,7 @@ H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type") break; } + /* H5Rget_name */ case H5VL_REF_GET_NAME: { @@ -3043,31 +3134,47 @@ H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object path") break; } + + /* H5Iget_name */ + case H5VL_ID_GET_NAME: + { + ssize_t *ret = va_arg(arguments, ssize_t *); + char *name = va_arg(arguments, char *); + size_t size = va_arg(arguments, size_t); + + /* Retrieve object's name */ + if((*ret = H5G_get_name(&loc, name, size, NULL)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") + + break; + } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object") - } + } /* end switch */ + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_get() */ +} /* end H5VL__native_object_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_object_specific + * Function: H5VL__native_object_specific * - * Purpose: Perform a driver specific operation for an objectibute + * Purpose: Perform a connector-specific operation for an objectibute * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t -H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5G_loc_t loc; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") @@ -3084,6 +3191,7 @@ H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object break; } + /* H5Oexists_by_name */ case H5VL_OBJECT_EXISTS: { @@ -3092,14 +3200,13 @@ H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* Check if the object exists */ if((*ret = H5G_loc_exists(&loc, loc_params.loc_data.loc_by_name.name)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", - loc_params.loc_data.loc_by_name.name) - } - else { + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", loc_params.loc_data.loc_by_name.name) + } /* end if */ + else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object exists parameters") - } break; } + case H5VL_OBJECT_VISIT: { H5_index_t idx_type = va_arg(arguments, H5_index_t); @@ -3113,16 +3220,17 @@ H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object /* H5Ovisit */ if((ret_value = H5O__visit(&loc, ".", idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Ovisit_by_name */ if((ret_value = H5O__visit(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") - } + } /* end else-if */ else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object visit params"); break; } + case H5VL_OBJECT_FLUSH: { hid_t oid = va_arg(arguments, hid_t); @@ -3133,6 +3241,7 @@ H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object break; } + case H5VL_OBJECT_REFRESH: { hid_t oid = va_arg(arguments, hid_t); @@ -3144,6 +3253,7 @@ H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object break; } + case H5VL_REF_CREATE: { void *ref = va_arg(arguments, void *); @@ -3161,19 +3271,20 @@ H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_specific() */ +} /* end H5VL__native_object_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_object_optional + * Function: H5VL__native_object_optional * - * Purpose: Perform a driver specific operation for an objectibute + * Purpose: Perform a connector-specific operation for an objectibute * * Return: Success: 0 * Failure: -1 @@ -3184,14 +3295,15 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req, va_list arguments) { H5VL_object_optional_t optional_type = va_arg(arguments, H5VL_object_optional_t); H5VL_loc_params_t loc_params = va_arg(arguments, H5VL_loc_params_t); H5G_loc_t loc; /* Location of group */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") @@ -3207,12 +3319,12 @@ H5VL_native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATT /* Retrieve the object's information */ if(H5G_loc_info(&loc, ".", obj_info, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */ /* Retrieve the object's information */ if(H5G_loc_info(&loc, loc_params.loc_data.loc_by_name.name, obj_info, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - } + } /* end else-if */ else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */ H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ @@ -3234,17 +3346,17 @@ H5VL_native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATT if(H5O_get_info(obj_loc.oloc, obj_info, fields) < 0) { H5G_loc_free(&obj_loc); HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") - } + } /* end if */ /* Release the object location */ if(H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") - } - else { - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") - } + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") + } /* end else-if */ + else + HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") break; } + /* H5Oget_comment / H5Oget_comment_by_name */ case H5VL_OBJECT_GET_COMMENT: { @@ -3256,16 +3368,16 @@ H5VL_native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATT if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Oget_comment */ if((*ret = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Oget_comment_by_name */ if((*ret = H5G_loc_get_comment(&loc, loc_params.loc_data.loc_by_name.name, comment/*out*/, bufsize)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - } - else { + } /* end else-if */ + else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters") - } break; } + /* H5Oset_comment */ case H5VL_OBJECT_SET_COMMENT: { @@ -3275,28 +3387,28 @@ H5VL_native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATT /* (Re)set the object's comment */ if(H5G_loc_set_comment(&loc, ".", comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Oset_comment_by_name */ /* (Re)set the object's comment */ if(H5G_loc_set_comment(&loc, loc_params.loc_data.loc_by_name.name, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - } - else { + } /* end else-if */ + else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters") - } break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't perform this operation on object"); - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_optional() */ +} /* end H5VL__native_object_optional() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_datatype_commit + * Function: H5VL__native_datatype_commit * * Purpose: Commits a datatype inside a native h5 file. * @@ -3309,15 +3421,16 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t type_id, - hid_t lcpl_id, hid_t tcpl_id, hid_t H5_ATTR_UNUSED tapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t H5_ATTR_UNUSED tapl_id, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5G_loc_t loc; /* Location to commit datatype */ H5T_t *dt; /* Datatype for ID */ H5T_t *type = NULL; /* copy of the original type which will be committed */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) @@ -3351,23 +3464,25 @@ H5VL_native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char /* H5Tcommit */ if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") - } + } /* end if */ else { /* H5Tcommit_anon */ if(H5T__commit_anon(loc.oloc->file, type, tcpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") - } + } /* end else */ + ret_value = (void *)type; done: if(NULL == ret_value && type) H5T_close(type); + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_datatype_commit() */ +} /* end H5VL__native_datatype_commit() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_datatype_open + * Function: H5VL__native_datatype_open * * Purpose: Opens a named datatype inside a native h5 file. * @@ -3377,14 +3492,14 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, - hid_t H5_ATTR_UNUSED tapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t H5_ATTR_UNUSED tapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5T_t *type = NULL; /* Datatype opened in file */ H5G_loc_t loc; /* Group location of object to open */ void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") @@ -3399,11 +3514,11 @@ H5VL_native_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *n done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_datatype_open() */ +} /* end H5VL__native_datatype_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_datatype_get + * Function: H5VL__native_datatype_get * * Purpose: Gets certain information about a datatype * @@ -3416,13 +3531,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_datatype_get(void *obj, H5VL_datatype_get_t get_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_datatype_get(void *obj, H5VL_datatype_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5T_t *dt = (H5T_t *)obj; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch (get_type) { case H5VL_DATATYPE_GET_BINARY: @@ -3437,6 +3552,7 @@ H5VL_native_datatype_get(void *obj, H5VL_datatype_get_t get_type, *nalloc = (ssize_t) size; break; } + /* H5Tget_create_plist */ case H5VL_DATATYPE_GET_TCPL: { @@ -3447,17 +3563,18 @@ H5VL_native_datatype_get(void *obj, H5VL_datatype_get_t get_type, break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from datatype") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_datatype_get() */ +} /* end H5VL__native_datatype_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_datatype_specific + * Function: H5VL__native_datatype_specific * * Purpose: Specific operations for datatype * @@ -3466,13 +3583,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, +H5VL__native_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5T_t *dt = (H5T_t *)obj; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(specific_type) { case H5VL_DATATYPE_FLUSH: @@ -3485,6 +3602,7 @@ H5VL_native_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, break; } + case H5VL_DATATYPE_REFRESH: { hid_t type_id = va_arg(arguments, hid_t); @@ -3495,17 +3613,18 @@ H5VL_native_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_datatype_specific() */ +} /* end H5VL__native_datatype_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_datatype_close + * Function: H5VL__native_datatype_close * * Purpose: Closes an datatype. * @@ -3518,16 +3637,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_datatype_close(void *dt, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_datatype_close(void *dt, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5T_close((H5T_t*)dt) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close datatype") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_datatype_close() */ +} /* end H5VL__native_datatype_close() */ diff --git a/src/H5VLnative.h b/src/H5VLnative.h index 832c758..af4ea59 100644 --- a/src/H5VLnative.h +++ b/src/H5VLnative.h @@ -11,13 +11,13 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Purpose: The public header file for the native VOL driver. + * Purpose: The public header file for the native VOL connector. */ #ifndef _H5VLnative_H #define _H5VLnative_H -/* Characteristics of the native VOL driver */ +/* Characteristics of the native VOL connector */ #define H5VL_NATIVE_NAME "native" #define H5VL_NATIVE_VALUE H5_VOL_NATIVE /* enum value */ #define H5VL_NATIVE_VERSION 0 @@ -34,3 +34,4 @@ H5_DLL herr_t H5Pset_fapl_native(hid_t fapl_id); #endif #endif /* _H5VLnative_H */ + diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h index 79a6e1c..559c8aa 100644 --- a/src/H5VLnative_private.h +++ b/src/H5VLnative_private.h @@ -11,27 +11,24 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Purpose: The private header file for the native VOL driver. + * Purpose: The private header file for the native VOL connector. */ #ifndef _H5VLnative_private_H #define _H5VLnative_private_H -/* Include driver's public header */ +/* Include connector's public header */ #include "H5VLnative.h" -/* Initializer function for native VOL driver */ -#define H5VL_NATIVE (H5VL_native_init()) +/* Initializer function for native VOL connector */ +#define H5VL_NATIVE (H5VL_native_init(H5P_DEFAULT)) #ifdef __cplusplus extern "C" { #endif -H5_DLL hid_t H5VL_native_get_driver_id(void); -H5_DLL hid_t H5VL_native_init(void); -H5_DLL hid_t H5VL_native_register(H5I_type_t type, const void *obj, hbool_t app_ref); -H5_DLL herr_t H5VL_native_unregister(hid_t obj_id); +H5_DLL hid_t H5VL_native_init(hid_t vipl_id); #ifdef __cplusplus } diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 003e6f5..83e9600 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -26,24 +26,24 @@ /* Library Private Typedefs */ /****************************/ -/* Internal struct to track VOL driver information for objects */ +/* Internal struct to track VOL connector information for objects */ typedef struct H5VL_t { - const H5VL_class_t *cls; /* Pointer to driver class struct */ + const H5VL_class_t *cls; /* Pointer to connector class struct */ int64_t nrefs; /* Number of references by objects using this struct */ - hid_t id; /* Identifier for the VOL driver */ + hid_t id; /* Identifier for the VOL connector */ } H5VL_t; /* Internal vol object structure returned to the API */ typedef struct H5VL_object_t { - void *data; /* Pointer to driver-managed data for this object */ - H5VL_t *driver; /* Pointer to VOL driver struct */ + void *data; /* Pointer to connector-managed data for this object */ + H5VL_t *connector; /* Pointer to VOL connector struct */ } H5VL_object_t; -/* Internal structure to hold the driver ID & info for FAPLs */ -typedef struct H5VL_driver_prop_t { - hid_t driver_id; /* VOL driver's ID */ - const void *driver_info; /* VOL driver info, for open callbacks */ -} H5VL_driver_prop_t; +/* Internal structure to hold the connector ID & info for FAPLs */ +typedef struct H5VL_connector_prop_t { + hid_t connector_id; /* VOL connector's ID */ + const void *connector_info; /* VOL connector info, for open callbacks */ +} H5VL_connector_prop_t; /*****************************/ /* Library Private Variables */ @@ -55,10 +55,16 @@ typedef struct H5VL_driver_prop_t { /* Utility functions */ H5_DLL herr_t H5VL_init(void); +H5_DLL int H5VL_cmp_connector_cls(const H5VL_class_t *cls1, const H5VL_class_t *cls); +H5_DLL int H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info, + const void *src_info); +H5_DLL int H5VL_cmp_connector_info(const H5VL_class_t *connector, const void *info1, + const void *info2); +H5_DLL herr_t H5VL_free_connector_info(const H5VL_class_t *connector, void *info); -/* Functions that deal with VOL drivers */ -H5_DLL hid_t H5VL_register_driver(const void *cls, size_t size, hbool_t app_ref); -H5_DLL ssize_t H5VL_get_driver_name(hid_t id, char *name/*out*/, size_t size); +/* Functions that deal with VOL connectors */ +H5_DLL hid_t H5VL_register_connector(const void *cls, hbool_t app_ref, hid_t vipl_id); +H5_DLL ssize_t H5VL_get_connector_name(hid_t id, char *name/*out*/, size_t size); /* NOTE: The object and ID functions below deal in VOL objects (i.e.; * H5VL_object_t). Similar non-VOL calls exist in H5Iprivate.h. Use @@ -72,78 +78,95 @@ H5_DLL ssize_t H5VL_get_driver_name(hid_t id, char *name/*out*/, size_t size); /* Functions that manipulate VOL objects */ H5_DLL void *H5VL_object(hid_t id); +H5_DLL void *H5VL_object_data(const H5VL_object_t *vol_obj); H5_DLL void *H5VL_object_verify(hid_t id, H5I_type_t obj_type); -H5_DLL void *H5VL_driver_data(H5VL_object_t *obj); H5_DLL H5VL_object_t *H5VL_vol_object(hid_t id); H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj); +/* Functions that wrap / unwrap VOL objects */ +H5_DLL herr_t H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj, + void **wrap_ctx); +H5_DLL herr_t H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx); +H5_DLL herr_t H5VL_set_vol_wrapper(void *obj, const H5VL_t *vol_connector); +H5_DLL herr_t H5VL_reset_vol_wrapper(void); +H5_DLL void * H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, + void *obj); + /* ID registration functions */ -H5_DLL hid_t H5VL_register(H5I_type_t type, const void *object, H5VL_t *vol_driver, hbool_t app_ref); -H5_DLL hid_t H5VL_register_using_vol_id(H5I_type_t type, const void *obj, hid_t driver_id, hbool_t app_ref); -H5_DLL herr_t H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref, hid_t existing_id); +H5_DLL hid_t H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref); +H5_DLL hid_t H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref); +H5_DLL hid_t H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool_t app_ref); +H5_DLL herr_t H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref, hid_t existing_id); + +/****************************** + * VOL connector callback wrappers + *****************************/ /* Attribute functions */ -H5_DLL void *H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *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 *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 *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 *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 *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 *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 *cls, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_attr_close(void *attr, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_attr_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_attr_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_attr_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_attr_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Dataset functions */ -H5_DLL void *H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *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 *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 *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 *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 *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 *cls, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_dataset_close(void *dset, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_dataset_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_dataset_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_dataset_read(const H5VL_object_t *vol_obj, 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(const H5VL_object_t *vol_obj, 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(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_dataset_specific(const H5VL_object_t *cls, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* File functions */ H5_DLL void *H5VL_file_create(const H5VL_class_t *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 *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 *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 *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 *cls, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_file_close(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Group functions */ -H5_DLL void *H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_group_close(void *grp, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_group_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_group_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_group_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Link functions */ -H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -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, const H5VL_class_t *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, const H5VL_class_t *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, const H5VL_class_t *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 *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 *cls, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_link_copy(const H5VL_object_t *src_vol_obj, H5VL_loc_params_t loc_params1, const H5VL_object_t *dst_vol_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_link_move(const H5VL_object_t *src_vol_obj, H5VL_loc_params_t loc_params1, const H5VL_object_t *dst_vol_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_link_get(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_link_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_link_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); /* Object functions */ -H5_DLL void *H5VL_object_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *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 *cls1, const char *src_name, void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *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, const H5VL_class_t *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 *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 *cls, hid_t dxpl_id, void **req, ...); +H5_DLL void *H5VL_object_open(const H5VL_object_t *vol_obj, H5VL_loc_params_t params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_object_copy(const H5VL_object_t *src_obj, H5VL_loc_params_t src_loc_params, const char *src_name, const H5VL_object_t *dst_obj, H5VL_loc_params_t dst_loc_params, 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(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_object_specific(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_object_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); /* Datatype functions */ -H5_DLL void *H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *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 *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 *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 *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 *cls, hid_t dxpl_id, void **req, ...); -H5_DLL herr_t H5VL_datatype_close(void *dt, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_datatype_commit(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, 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(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_datatype_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* Asynchronous functions */ -H5_DLL herr_t H5VL_request_cancel(void **req, const H5VL_class_t *cls, H5ES_status_t *status); -H5_DLL herr_t H5VL_request_test(void **req, const H5VL_class_t *cls, H5ES_status_t *status); -H5_DLL herr_t H5VL_request_wait(void **req, const H5VL_class_t *cls, H5ES_status_t *status); +H5_DLL herr_t H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout, H5ES_status_t *status); +H5_DLL herr_t H5VL_request_cancel(const H5VL_object_t *vol_obj); +H5_DLL herr_t H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_specific_t specific_type, ...); +H5_DLL herr_t H5VL_request_optional(const H5VL_object_t *vol_obj, ...); +H5_DLL herr_t H5VL_request_free(const H5VL_object_t *vol_obj); + #endif /* _H5VLprivate_H */ diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 600de0d..7049930 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -52,7 +52,7 @@ /* Group creation property names */ #define H5VL_PROP_GRP_LCPL_ID "group_lcpl_id" -/* Default VOL driver value */ +/* Default VOL connector value */ #define H5VL_VOL_DEFAULT 0 @@ -112,17 +112,17 @@ typedef enum H5VL_datatype_specific_t { typedef enum H5VL_file_get_t { H5VL_FILE_GET_FAPL, /* file access property list */ H5VL_FILE_GET_FCPL, /* file creation property list */ - H5VL_FILE_GET_INTENT, /* file intent */ + H5VL_FILE_GET_INTENT, /* file intent */ H5VL_FILE_GET_NAME, /* file name */ H5VL_FILE_GET_OBJ_COUNT, /* object count in file */ - H5VL_FILE_GET_OBJ_IDS, /* object ids in file */ - H5VL_OBJECT_GET_FILE /* retrieve or resurrect file of object */ + H5VL_FILE_GET_OBJ_IDS /* object ids in file */ } H5VL_file_get_t; /* types for file SPECIFIC callback */ typedef enum H5VL_file_specific_t { H5VL_FILE_FLUSH, /* Flush file */ H5VL_FILE_IS_ACCESSIBLE, /* Check if a file is accessible */ + H5VL_FILE_REOPEN, /* Reopen the file */ H5VL_FILE_MOUNT, /* Mount a file */ H5VL_FILE_UNMOUNT /* Un-Mount a file */ } H5VL_file_specific_t; @@ -162,21 +162,29 @@ typedef enum H5VL_link_specific_t { /* types for object GET callback */ typedef enum H5VL_object_get_t { - H5VL_REF_GET_NAME, /* object name */ + H5VL_REF_GET_NAME, /* object name, for reference */ H5VL_REF_GET_REGION, /* dataspace of region */ - H5VL_REF_GET_TYPE /* type of object */ + H5VL_REF_GET_TYPE, /* type of object */ + H5VL_ID_GET_NAME /* object name, for hid_t */ } H5VL_object_get_t; /* types for object SPECIFIC callback */ typedef enum H5VL_object_specific_t { - H5VL_OBJECT_CHANGE_REF_COUNT, /* H5Oincr/decr_refcount */ - H5VL_OBJECT_EXISTS, /* H5Oexists_by_name */ - H5VL_OBJECT_VISIT, /* H5Ovisit(_by_name) */ - H5VL_REF_CREATE, /* H5Rcreate */ - H5VL_OBJECT_FLUSH, - H5VL_OBJECT_REFRESH + H5VL_OBJECT_CHANGE_REF_COUNT, /* H5Oincr/decr_refcount */ + H5VL_OBJECT_EXISTS, /* H5Oexists_by_name */ + H5VL_OBJECT_VISIT, /* H5Ovisit(_by_name) */ + H5VL_REF_CREATE, /* H5Rcreate */ + H5VL_OBJECT_FLUSH, /* H5{D|G|O|T}flush */ + H5VL_OBJECT_REFRESH /* H5{D|G|O|T}refresh */ } H5VL_object_specific_t; +/* types for async request SPECIFIC callback */ +typedef enum H5VL_request_specific_t { + H5VL_REQUEST_WAITANY, /* Wait until any request completes */ + H5VL_REQUEST_WAITSOME, /* Wait until at least one requesst completes */ + H5VL_REQUEST_WAITALL /* Wait until all requests complete */ +} H5VL_request_specific_t; + /* types for different ways that objects are located in an HDF5 container */ typedef enum H5VL_loc_type_t { H5VL_OBJECT_BY_SELF, @@ -328,57 +336,58 @@ typedef struct H5VL_object_class_t { herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); } H5VL_object_class_t; -/* H5AO routines */ -typedef struct H5VL_async_class_t { - herr_t (*cancel)(void **, H5ES_status_t *); - herr_t (*test) (void **, H5ES_status_t *); - herr_t (*wait) (void **, H5ES_status_t *); -} H5VL_async_class_t; - -/* VOL category (internal, external, etc.) - * XXX: This is intended to replace the H5VL_class_value_t struct, which seems - * difficult to manage. It's currently unused so I don't break struct - * compatibility with existing VOLs. - */ -typedef enum H5VL_category_t { - H5VL_INTERNAL, /* Internal VOL driver */ - H5VL_EXTERNAL /* External VOL driver (plugin) */ -} H5VL_category_t; +/* Async operation routines */ +typedef struct H5VL_request_class_t { + herr_t (*wait)(void *req, uint64_t timeout, H5ES_status_t *status); + herr_t (*cancel)(void *req); + herr_t (*specific)(void *req, H5VL_request_specific_t specific_type, va_list arguments); + herr_t (*optional)(void *req, va_list arguments); + herr_t (*free)(void *req); +} H5VL_request_class_t; + -/* enum value to identify the class of a VOL driver (mostly for comparison purposes) */ +/* enum value to identify the class of a VOL connector (mostly for comparison purposes) */ typedef enum H5VL_class_value_t { H5_VOL_NATIVE = 0, /* This should be first */ H5_VOL_MAX_LIB_VALUE = 128 /* This should be last */ } H5VL_class_value_t; -/* Class information for each VOL driver */ + +/* Capability flags for connector */ +#define H5VL_CAP_FLAG_NONE 0 /* No special connector capabilities */ +#define H5VL_CAP_FLAG_THREADSAFE 0x01 /* Connector is threadsafe */ + + +/* Class information for each VOL connector */ /* XXX: We should consider adding a UUID/GUID field to this struct * as well as a H5VLregister_by_uuid() API call for people who - * really care about getting a particular VOL driver. + * really care about getting a particular VOL connector. * XXX: We should also consider adding enough information so that - * files can be opened without specifying the VOL driver. + * files can be opened without specifying the VOL connector. * e.g.: If we stored a UUID and version, we could search for - * a matching VOL driver so a user did not have to make any + * a matching VOL connector so a user did not have to make any * H5VL calls. */ typedef struct H5VL_class_t { - /* XXX: How do we identify unique VOL drivers? + /* XXX: How do we identify unique VOL connector? * This is unclear, but for now we'll keep * all the ID fields from the original VOL * branch. */ - unsigned int version; /* VOL driver version # - * XXX: Is this supposed to be a VOL driver - * version number or a VOL API version - * number? Maybe we need both? - */ - H5VL_class_value_t value; /* value to identify driver */ - const char *name; /* Plugin name (MUST be unique!) */ - herr_t (*initialize)(hid_t vipl_id); /* Plugin initialization callback */ - herr_t (*terminate)(hid_t vtpl_id); /* Plugin termination callback */ - size_t fapl_size; /* size of the vol info in the fapl property */ - void * (*fapl_copy)(const void *info); /* callback to create a copy of the vol info */ - herr_t (*fapl_free)(void *info); /* callback to release the vol info copy */ + unsigned int version; /* VOL connector API version # */ + H5VL_class_value_t value; /* value to identify connector */ + const char *name; /* connector name (MUST be unique!) */ + unsigned cap_flags; /* capability flags for connector */ + herr_t (*initialize)(hid_t vipl_id); /* Connector initialization callback */ + herr_t (*terminate)(void); /* Connector termination callback */ + size_t info_size; /* size of the vol info */ + void * (*info_copy)(const void *info); /* callback to create a copy of the vol info */ + int (*info_cmp)(const void *info1, const void *info2); /* callback to compare vol info */ + herr_t (*info_free)(void *info); /* callback to release the vol info copy */ + void * (*get_object)(const void *obj); /* callback to retrieve underlying object */ + herr_t (*get_wrap_ctx)(const void *obj, void **wrap_ctx); /* callback to retrieve the object wrapping context for the connector */ + herr_t (*free_wrap_ctx)(void *wrap_ctx); /* callback to release the object wrapping context for the connector */ + void* (*wrap_object)(void *obj, void *wrap_ctx); /* callback to wrap an object */ /* Data Model */ H5VL_attr_class_t attr_cls; /* attribute class callbacks */ @@ -390,7 +399,9 @@ typedef struct H5VL_class_t { H5VL_object_class_t object_cls; /* object class callbacks */ /* Services */ - H5VL_async_class_t async_cls; /* asynchronous class callbacks */ + H5VL_request_class_t request_cls; /* asynchronous request class callbacks */ + + /* Catch-all */ herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); /* Optional callback */ } H5VL_class_t; @@ -407,92 +418,113 @@ typedef struct H5VL_class_t { extern "C" { #endif -/* VOL Driver/Plugin Functionality */ -H5_DLL herr_t H5VLinitialize(hid_t driver_id, hid_t vipl_id); -H5_DLL herr_t H5VLterminate(hid_t driver_id, hid_t vtpl_id); -H5_DLL herr_t H5VLclose(hid_t driver_id); -H5_DLL hid_t H5VLregister_driver(const H5VL_class_t *cls); -H5_DLL hid_t H5VLregister_driver_by_name(const char *driver_name); -H5_DLL herr_t H5VLunregister_driver(hid_t driver_id); -H5_DLL htri_t H5VLis_driver_registered(const char *name); -H5_DLL hid_t H5VLget_driver_id(const char *name); -H5_DLL ssize_t H5VLget_driver_name(hid_t id, char *name/*out*/, size_t size); -H5_DLL hid_t H5VLregister(H5I_type_t obj_type, const void *obj, hid_t driver_id); -H5_DLL void *H5VLobject(hid_t id); -H5_DLL herr_t H5VLget_object(hid_t obj_id, void **obj); - -/* Attributes */ -H5_DLL void *H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_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 driver_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLattr_read(void *attr, hid_t driver_id, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLattr_write(void *attr, hid_t driver_id, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLattr_get(void *obj, hid_t driver_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 driver_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 driver_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLattr_close(void *attr, hid_t driver_id, hid_t dxpl_id, void **req); - -/* Datasets */ -H5_DLL void *H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_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 driver_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLdataset_read(void *dset, hid_t driver_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 driver_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 driver_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 driver_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 driver_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdataset_close(void *dset, hid_t driver_id, hid_t dxpl_id, void **req); - -/* Files */ +/* VOL Connector Functionality */ +H5_DLL hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id); +H5_DLL hid_t H5VLregister_connector_by_name(const char *connector_name, hid_t vipl_id); +H5_DLL htri_t H5VLis_connector_registered(const char *name); +H5_DLL hid_t H5VLget_connector_id(const char *name); +H5_DLL ssize_t H5VLget_connector_name(hid_t id, char *name/*out*/, size_t size); +H5_DLL herr_t H5VLclose(hid_t connector_id); +H5_DLL herr_t H5VLunregister_connector(hid_t connector_id); + + +/***************************************************************************** + * VOL callback wrappers and helper routines, for _VOL_connector_ authors only! * + * (Not part of the public API for _application_ developers) * + *****************************************************************************/ + +/* Helper routines for VOL connector authors */ +H5_DLL herr_t H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connector_id2); + + +/* Public wrappers for generic callbacks */ +H5_DLL herr_t H5VLinitialize(hid_t connector_id, hid_t vipl_id); +H5_DLL herr_t H5VLterminate(hid_t connector_id); +H5_DLL herr_t H5VLget_cap_flags(hid_t connector_id, unsigned *cap_flags); +H5_DLL herr_t H5VLcopy_connector_info(hid_t connector_id, void **dst_vol_info, void *src_vol_info); +H5_DLL herr_t H5VLcmp_connector_info(int *cmp, hid_t connector_id, const void *info1, + const void *info2); +H5_DLL herr_t H5VLfree_connector_info(hid_t connector_id, void *vol_info); +H5_DLL void *H5VLget_object(void *obj, hid_t connector_id); +H5_DLL herr_t H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx); +H5_DLL herr_t H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id); +H5_DLL void *H5VLwrap_object(void *obj, hid_t connector_id, void *wrap_ctx); + +/* Public wrappers for attribute callbacks */ +H5_DLL void *H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t connector_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 connector_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_read(void *attr, hid_t connector_id, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_write(void *attr, hid_t connector_id, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_get(void *obj, hid_t connector_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 connector_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 connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_close(void *attr, hid_t connector_id, hid_t dxpl_id, void **req); + +/* Public wrappers for dataset callbacks */ +H5_DLL void *H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLdataset_read(void *dset, hid_t connector_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 connector_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 connector_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 connector_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 connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_close(void *dset, hid_t connector_id, hid_t dxpl_id, void **req); + +/* Public wrappers for file callbacks */ 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 driver_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 driver_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 driver_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLfile_close(void *file, hid_t driver_id, hid_t dxpl_id, void **req); - -/* Groups */ -H5_DLL void *H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_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 driver_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLgroup_get(void *obj, hid_t driver_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 driver_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 driver_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLgroup_close(void *grp, hid_t driver_id, hid_t dxpl_id, void **req); - -/* Links */ -H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLfile_get(void *file, hid_t connector_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 connector_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 connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_close(void *file, hid_t connector_id, hid_t dxpl_id, void **req); + +/* Public wrappers for group callbacks */ +H5_DLL void *H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLgroup_get(void *obj, hid_t connector_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 connector_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 connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_close(void *grp, hid_t connector_id, hid_t dxpl_id, void **req); + +/* Public wrappers for link callbacks */ +H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, hid_t connector_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, hid_t driver_id, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t connector_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, hid_t driver_id, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t connector_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, hid_t driver_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 driver_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 driver_id, hid_t dxpl_id, void **req, va_list arguments); - -/* Objects */ -H5_DLL void *H5VLobject_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_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 driver_id1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, hid_t driver_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, hid_t driver_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 driver_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 driver_id, hid_t dxpl_id, void **req, va_list arguments); - -/* Datatypes */ -H5_DLL void *H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t driver_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 driver_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t driver_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 driver_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 driver_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t driver_id, hid_t dxpl_id, void **req); - -/* Asynchronous Requests */ -H5_DLL herr_t H5VLrequest_cancel(void **req, hid_t driver_id, H5ES_status_t *status); -H5_DLL herr_t H5VLrequest_test(void **req, hid_t driver_id, H5ES_status_t *status); -H5_DLL herr_t H5VLrequest_wait(void **req, hid_t driver_id, H5ES_status_t *status); +H5_DLL herr_t H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t connector_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 connector_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 connector_id, hid_t dxpl_id, void **req, va_list arguments); + +/* Public wrappers for object callbacks */ +H5_DLL void *H5VLobject_open(void *obj, H5VL_loc_params_t loc_params, hid_t connector_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, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name, + hid_t connector_id, 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, hid_t connector_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 connector_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 connector_id, hid_t dxpl_id, void **req, va_list arguments); + +/* Public wrappers for named datatype callbacks */ +H5_DLL void *H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t connector_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 connector_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t connector_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 connector_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 connector_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t connector_id, hid_t dxpl_id, void **req); + +/* Public wrappers for asynchronous request callbacks */ +H5_DLL herr_t H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5ES_status_t *status); +H5_DLL herr_t H5VLrequest_cancel(void *req, hid_t connector_id); +H5_DLL herr_t H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_t specific_type, va_list arguments); +H5_DLL herr_t H5VLrequest_optional(void *req, hid_t connector_id, va_list arguments); +H5_DLL herr_t H5VLrequest_free(void *req, hid_t connector_id); #ifdef __cplusplus } #endif #endif /* _H5VLpublic_H */ + @@ -586,7 +586,9 @@ static int H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key) { H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */ +#ifdef H5_HAVE_PARALLEL H5Z_object_t *object = (H5Z_object_t *)key; +#endif /* H5_HAVE_PARALLEL */ int ret_value = FALSE; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5private.h b/src/H5private.h index 63f6858..b654bae 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2086,10 +2086,11 @@ H5_DLL herr_t H5CX_pop(void); /* * Use this macro for API functions that shouldn't perform _any_ initialization * of the library or an interface, just perform tracing, etc. Examples - * are: H5allocate_memory, H5is_library_threadsafe, etc. + * are: H5allocate_memory, H5is_library_threadsafe, public VOL callback + * wrappers (e.g. H5VLfile_create, H5VLdataset_read, etc.), etc. * */ -#define FUNC_ENTER_API_NOINIT {{ \ +#define FUNC_ENTER_API_NOINIT {{{ \ FUNC_ENTER_API_COMMON \ H5_PUSH_FUNC \ BEGIN_MPE_LOG \ @@ -2102,7 +2103,7 @@ H5_DLL herr_t H5CX_pop(void); * are: H5close, H5check_version, etc. * */ -#define FUNC_ENTER_API_NOINIT_NOERR_NOFS {{ \ +#define FUNC_ENTER_API_NOINIT_NOERR_NOFS {{{{ \ FUNC_ENTER_API_VARS \ FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \ FUNC_ENTER_API_THREADSAFE; \ @@ -2289,14 +2290,14 @@ H5_DLL herr_t H5CX_pop(void); (void)H5E_dump_api_stack(TRUE); \ FUNC_LEAVE_API_THREADSAFE \ return(ret_value); \ -}} /*end scope from beginning of FUNC_ENTER*/ +}}} /*end scope from beginning of FUNC_ENTER*/ /* Use this macro to match the FUNC_ENTER_API_NOINIT_NOERR_NOFS macro */ #define FUNC_LEAVE_API_NOFS(ret_value) \ FUNC_LEAVE_API_COMMON(ret_value); \ FUNC_LEAVE_API_THREADSAFE \ return(ret_value); \ -}} /*end scope from beginning of FUNC_ENTER*/ +}}}} /*end scope from beginning of FUNC_ENTER*/ #define FUNC_LEAVE_NOAPI(ret_value) \ ; \ diff --git a/src/H5trace.c b/src/H5trace.c index 08db09a..de63c4c 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -834,8 +834,8 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case H5ES_STATUS_FAIL: HDfprintf(out, "H5ES_STATUS_FAIL"); break; - case H5ES_STATUS_CANCEL: - HDfprintf(out, "H5ES_STATUS_CANCEL"); + case H5ES_STATUS_CANCELLED: + HDfprintf(out, "H5ES_STATUS_CANCELLED"); break; default: @@ -2711,9 +2711,6 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case H5VL_FILE_GET_OBJ_IDS: HDfprintf(out, "H5VL_FILE_GET_OBJ_IDS"); break; - case H5VL_OBJECT_GET_FILE: - HDfprintf(out, "H5VL_OBJECT_GET_FILE"); - break; default: HDfprintf(out, "%ld", (long)get); break; @@ -2734,6 +2731,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case H5VL_FILE_FLUSH: HDfprintf(out, "H5VL_FILE_FLUSH"); break; + case H5VL_FILE_REOPEN: + HDfprintf(out, "H5VL_FILE_REOPEN"); + break; case H5VL_FILE_MOUNT: HDfprintf(out, "H5VL_FILE_MOUNT"); break; @@ -2893,6 +2893,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case H5VL_REF_GET_NAME: HDfprintf(out, "H5VL_REF_GET_NAME"); break; + case H5VL_ID_GET_NAME: + HDfprintf(out, "H5VL_ID_GET_NAME"); + break; default: HDfprintf(out, "%ld", (long)get); break; diff --git a/src/Makefile.am b/src/Makefile.am index ffdf844..d91cca8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -114,7 +114,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Topaque.c \ H5Torder.c \ H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c \ - H5VL.c H5VLint.c H5VLnative.c \ + H5VL.c H5VLcallback.c H5VLint.c H5VLnative.c \ H5VM.c H5WB.c H5Z.c \ H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \ H5Zscaleoffset.c H5Zszip.c H5Ztrans.c diff --git a/test/dsets.c b/test/dsets.c index 050bd8f..5cd376a 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -826,7 +826,7 @@ test_compact_io(hid_t fapl) **************************************/ /* Create a copy of file access property list */ - if((new_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR + if((new_fapl = new_fapl = h5_fileaccess()) < 0) TEST_ERROR /* Loop through all the combinations of low/high library format bounds, skipping invalid combinations. @@ -1334,6 +1334,19 @@ test_conv_buffer(hid_t fid) return 0; error: + H5E_BEGIN_TRY { + H5Pclose(xfer_list); + H5Sclose(space); + H5Tclose(arr_type1); + H5Tclose(arr_type2); + H5Tclose(arr_type3); + H5Tclose(ctype1); + H5Tclose(ctype2); + H5Tclose(arr_type4); + H5Tclose(arr_type5); + H5Dclose(dataset); + } H5E_END_TRY; + return -1; } diff --git a/test/dtypes.c b/test/dtypes.c index 3253d6c..7e5a992 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -6957,13 +6957,13 @@ test_delete_obj_named_fileid(hid_t fapl) /* Verify file ID from dataset matches correct file */ dset_fid = H5Iget_file_id(dset); - if(dset_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(dset_fid, filea1)) TEST_ERROR H5Fclose(dset_fid); /* Verify file ID from datatype (from dataset) matches correct file */ type = H5Dget_type(dset); type_fid = H5Iget_file_id(type); - if(type_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(type_fid, filea1)) TEST_ERROR H5Fclose(type_fid); H5Tclose(type); @@ -6979,13 +6979,13 @@ test_delete_obj_named_fileid(hid_t fapl) /* Verify file ID from dataset matches correct file */ dset_fid = H5Iget_file_id(dset); - if(dset_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(dset_fid, filea1)) TEST_ERROR H5Fclose(dset_fid); /* Verify file ID from datatype (from dataset) matches correct file */ type = H5Dget_type(dset); type_fid = H5Iget_file_id(type); - if(type_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(type_fid, filea1)) TEST_ERROR H5Fclose(type_fid); H5Tclose(type); @@ -7007,13 +7007,13 @@ test_delete_obj_named_fileid(hid_t fapl) /* Verify file ID from dataset matches correct file */ attr_fid = H5Iget_file_id(attr); - if(attr_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(attr_fid, filea1)) TEST_ERROR H5Fclose(attr_fid); /* Verify file ID from datatype (from dataset) matches correct file */ type = H5Aget_type(attr); type_fid = H5Iget_file_id(type); - if(type_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(type_fid, filea1)) TEST_ERROR H5Fclose(type_fid); H5Tclose(type); @@ -7029,13 +7029,13 @@ test_delete_obj_named_fileid(hid_t fapl) /* Verify file ID from dataset matches correct file */ attr_fid = H5Iget_file_id(attr); - if(attr_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(attr_fid, filea1)) TEST_ERROR H5Fclose(attr_fid); /* Verify file ID from datatype (from dataset) matches correct file */ type = H5Aget_type(attr); type_fid = H5Iget_file_id(type); - if(type_fid != filea1) TEST_ERROR + if(!H5F__same_file_test(type_fid, filea1)) TEST_ERROR H5Fclose(type_fid); H5Tclose(type); diff --git a/test/file_image.c b/test/file_image.c index 12f0a18..0dba236 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -579,7 +579,8 @@ test_core(void) reset_udata(udata); file = H5Fopen(copied_filename, H5F_ACC_RDONLY, fapl); VERIFY(file >= 0, "H5Fopen failed"); - VERIFY(udata->used_callbacks == MALLOC, "opening a core file used the wrong callbacks"); + VERIFY((udata->used_callbacks == MALLOC) || + (udata->used_callbacks == MALLOC | UDATA_COPY | UDATA_FREE), "opening a core file used the wrong callbacks"); VERIFY(udata->malloc_src == H5FD_FILE_IMAGE_OP_FILE_OPEN, "Malloc callback came from wrong sourc in core open"); /* Close file */ diff --git a/test/h5test.c b/test/h5test.c index c1cc55b..3c02e4e 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1908,14 +1908,14 @@ error: * Purpose: Returns a disposable, generally non-functional, * VOL class struct. * - * In some of the test code, we need a disposable VOL driver + * In some of the test code, we need a disposable VOL plugin * but we don't want to mess with the real VFDs and we also - * don't have access to the internals of the real VOL drivers + * don't have access to the internals of the real VOL plugins * (which use static globals and functions) to easily duplicate - * them (e.g.: for testing VOL driver ID handling). + * them (e.g.: for testing VOL plugin ID handling). * * This API call will return a pointer to a VOL class that - * can be used to construct a test VOL using H5VLregister_driver(). + * can be used to construct a test VOL using H5VLregister_plugin(). * * Return: Success: A pointer to a VOL class struct * Failure: NULL @@ -1931,7 +1931,7 @@ h5_get_dummy_vol_class(void) if(NULL == (vol_class = (H5VL_class_t *)HDcalloc((size_t)1, sizeof(H5VL_class_t)))) TEST_ERROR; - /* Fill in the minimum parameters to make a VOL driver class that + /* Fill in the minimum parameters to make a VOL plugin class that * can be registered. */ vol_class->name = "dummy"; diff --git a/test/objcopy.c b/test/objcopy.c index f13537e..6ee2f72 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -2151,7 +2151,7 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) buf[i][j] = 10000 + 100*i+j; /* Create a file access property list for destination file */ - if ((fapl_dst = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR + if ((fapl_dst = h5_fileaccess()) < 0) TEST_ERROR /* Initialize the filenames */ h5_fixname(FILENAME[4], fapl_src, src_fname, sizeof src_fname); @@ -7854,6 +7854,7 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open) { hid_t fid_src = -1, fid_dst = -1; /* File IDs */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t src_fapl = -1; /* Source file FAPL ID */ const char *src_filename = H5_get_srcdir_filename(FILE_OLD_LAYOUT); /* Corrected test file name */ char dst_filename[NAME_BUF_SIZE]; @@ -7869,8 +7870,14 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open) /* Reset file address checking info */ addr_reset(); + /* Setup */ + if((src_fapl = h5_fileaccess()) < 0) TEST_ERROR + /* open source file (read-only) */ - if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR + + /* Close source FAPL */ + if(H5Pclose(src_fapl) < 0) TEST_ERROR /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR @@ -7914,6 +7921,7 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open) error: H5E_BEGIN_TRY { + H5Pclose(src_fapl); H5Dclose(did2); H5Dclose(did); H5Fclose(fid_dst); diff --git a/test/ohdr.c b/test/ohdr.c index 2b57ada..cca7e7e 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -486,7 +486,7 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) FAIL_STACK_ERROR /* Open FILE_BOGUS */ - if((fid_bogus = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + if((fid_bogus = H5Fopen(testfile, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Set up location ID depending on bogus_id */ diff --git a/test/swmr.c b/test/swmr.c index 3b2af4e..bab91bd 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -6500,10 +6500,9 @@ test_refresh_concur(hid_t in_fapl, hbool_t new_format) HDexit(EXIT_FAILURE); /* Wait for notification from parent process */ - while(child_notify != 1) { + while(child_notify != 1) if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) HDexit(EXIT_FAILURE); - } /* Open the file 2 times */ if((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) @@ -6540,10 +6539,9 @@ test_refresh_concur(hid_t in_fapl, hbool_t new_format) HDexit(EXIT_FAILURE); /* Wait for notification from parent process */ - while(child_notify != 3) { + while(child_notify != 3) if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) HDexit(EXIT_FAILURE); - } /* Refresh dataset via did1 */ if(H5Drefresh(child_did1) < 0) diff --git a/test/testfiles/error_test_1 b/test/testfiles/error_test_1 index 473c53e..f0e4a62 100644 --- a/test/testfiles/error_test_1 +++ b/test/testfiles/error_test_1 @@ -41,25 +41,28 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dread(): can't read data major: Dataset minor: Read failed - #001: (file name) line (number) in H5VL_dataset_read(): read failed + #001: (file name) line (number) in H5VL_dataset_read(): dataset read failed major: Virtual Object Layer minor: Read failed - #002: (file name) line (number) in H5VL_native_dataset_read(): can't read data + #002: (file name) line (number) in H5VL__dataset_read(): dataset read failed + major: Virtual Object Layer + minor: Read failed + #003: (file name) line (number) in H5VL__native_dataset_read(): can't read data major: Dataset minor: Read failed - #003: (file name) line (number) in H5D__read(): can't read data + #004: (file name) line (number) in H5D__read(): can't read data major: Dataset minor: Read failed - #004: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk + #005: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk major: Low-level I/O minor: Read failed - #005: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed + #006: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed major: Dataset minor: Filter operation failed - #006: (file name) line (number) in H5Z_pipeline(): required filter 'bogus' is not registered + #007: (file name) line (number) in H5Z_pipeline(): required filter 'bogus' is not registered major: Data filters minor: Read failed - #007: (file name) line (number) in H5PL_load(): filter plugins disabled + #008: (file name) line (number) in H5PL_load(): filter plugins disabled major: Plugin for dynamically loaded library minor: Unable to load metadata into cache diff --git a/test/tfile.c b/test/tfile.c index 12a0eca..e342da0 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1600,6 +1600,7 @@ test_file_is_accessible(void) { hid_t fid; /* File opened with read-write permission */ hid_t fcpl_id; /* File creation property list */ + hid_t fapl = -1; /* File access property list */ int fd; /* POSIX file descriptor */ ssize_t nbytes; /* Number of bytes written */ unsigned u; /* Local index variable */ @@ -1610,8 +1611,12 @@ test_file_is_accessible(void) /* Output message about test being performed */ MESSAGE(5, ("Testing Detection of HDF5 Files\n")); + /* Get FAPL */ + fapl = h5_fileaccess(); + CHECK(fapl, FAIL, "H5Pcreate"); + /* Create a file */ - fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid, FAIL, "H5Fcreate"); /* Close file */ @@ -1619,7 +1624,7 @@ test_file_is_accessible(void) CHECK(ret, FAIL, "H5Fclose"); /* Verify that the file is an HDF5 file */ - status = H5Fis_accessible(FILE1, H5P_DEFAULT); + status = H5Fis_accessible(FILE1, fapl); VERIFY(status, TRUE, "H5Fis_accessible"); @@ -1631,7 +1636,7 @@ test_file_is_accessible(void) CHECK(ret, FAIL, "H5Pset_userblock"); /* Create file with non-default user block */ - fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl_id, fapl); CHECK(fid, FAIL, "H5Fcreate"); /* Release file-creation property list */ @@ -1643,7 +1648,7 @@ test_file_is_accessible(void) CHECK(ret, FAIL, "H5Fclose"); /* Verify that the file is an HDF5 file */ - status = H5Fis_accessible(FILE1, H5P_DEFAULT); + status = H5Fis_accessible(FILE1, fapl); VERIFY(status, TRUE, "H5Fis_accessible"); @@ -1664,9 +1669,13 @@ test_file_is_accessible(void) CHECK(ret, FAIL, "HDclose"); /* Verify that the file is not an HDF5 file */ - status = H5Fis_accessible(FILE1, H5P_DEFAULT); + status = H5Fis_accessible(FILE1, fapl); VERIFY(status, FALSE, "H5Fis_accessible"); + /* Close property list */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + } /* end test_file_is_accessible() */ @@ -1683,6 +1692,7 @@ test_file_ishdf5(void) { hid_t file; /* File opened with read-write permission */ hid_t fcpl; /* File creation property list */ + hid_t fapl = -1; /* File access property list */ int fd; /* File Descriptor */ ssize_t nbytes; /* Number of bytes written */ unsigned u; /* Local index variable */ @@ -1693,8 +1703,12 @@ test_file_ishdf5(void) /* Output message about test being performed */ MESSAGE(5, ("Testing Detection of HDF5 Files (using deprecated H5Fis_hdf5() call)\n")); + /* Get FAPL */ + fapl = h5_fileaccess(); + CHECK(fapl, FAIL, "H5Pcreate"); + /* Create a file */ - file = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + file = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(file, FAIL, "H5Fcreate"); /* Close file */ @@ -1714,7 +1728,7 @@ test_file_ishdf5(void) CHECK(ret, FAIL, "H5Pset_userblock"); /* Create file with non-default user block */ - file = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); + file = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); CHECK(file, FAIL, "H5Fcreate"); /* Release file-creation property list */ @@ -1750,6 +1764,10 @@ test_file_ishdf5(void) status = H5Fis_hdf5(FILE1); VERIFY(status, FALSE, "H5Fis_hdf5"); + /* Close property list */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + } /* end test_file_ishdf5() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -2240,10 +2258,8 @@ test_file_double_file_dataset_open(hbool_t new_format) MESSAGE(5, ("Testing double file and dataset open/close\n")); /* Setting up test file */ - - fapl = H5Pcreate(H5P_FILE_ACCESS); + fapl = h5_fileaccess(); CHECK(fapl, FAIL, "H5Pcreate"); - if(new_format) { ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); CHECK(ret, FAIL, "H5Pset_libver_bounds"); @@ -4165,10 +4181,7 @@ test_file_freespace(const char *env_h5_drvr) /* Check that there is the right amount of free space in the file */ free_space = H5Fget_freespace(file); CHECK(free_space, FAIL, "H5Fget_freespace"); - if(new_format) - VERIFY(free_space, expected_fs_del, "H5Fget_freespace"); - else - VERIFY(free_space, expected_fs_del, "H5Fget_freespace"); + VERIFY(free_space, expected_fs_del, "H5Fget_freespace"); /* Close file */ ret = H5Fclose(file); diff --git a/test/tmisc.c b/test/tmisc.c index 2a977bf..fef94dd 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -3481,15 +3481,15 @@ test_misc19(void) HDfree(vfd_cls); -/* Check H5I operations on virtual object drivers */ +/* Check H5I operations on virtual object connectors */ /* Get a VOL class to register */ vol_cls = h5_get_dummy_vol_class(); CHECK(vol_cls, NULL, "h5_get_dummy_vol_class"); - /* Register a VOL driver */ - volid = H5VLregister_driver(vol_cls); - CHECK(volid, FAIL, "H5VLregister_driver"); + /* Register a VOL connector */ + volid = H5VLregister_connector(vol_cls, H5P_DEFAULT); + CHECK(volid, FAIL, "H5VLregister_connector"); /* Check the reference count */ rc = H5Iget_ref(volid); @@ -3499,23 +3499,23 @@ test_misc19(void) rc = H5Iinc_ref(volid); VERIFY(rc, 2, "H5Iinc_ref"); - /* Unregister the VOL driver normally */ - ret = H5VLunregister_driver(volid); - CHECK(ret, FAIL, "H5VLunregister_driver"); + /* Unregister the VOL connector normally */ + ret = H5VLunregister_connector(volid); + CHECK(ret, FAIL, "H5VLunregister_connector"); /* Check the reference count */ rc = H5Iget_ref(volid); VERIFY(rc, 1, "H5Iget_ref"); - /* Unregister the VOL driver by decrementing the reference count */ + /* Unregister the VOL connector by decrementing the reference count */ rc = H5Idec_ref(volid); VERIFY(rc, 0, "H5Idec_ref"); - /* Try unregistering the VOL driver again (should fail) */ + /* Try unregistering the VOL connector again (should fail) */ H5E_BEGIN_TRY { - ret = H5VLunregister_driver(volid); + ret = H5VLunregister_connector(volid); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5VLunregister_driver"); + VERIFY(ret, FAIL, "H5VLunregister_connector"); HDfree(vol_cls); diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c index e04ddf3..56d87ee 100644 --- a/test/ttsafe_error.c +++ b/test/ttsafe_error.c @@ -74,28 +74,31 @@ tts_error(void) expected_g[0].min_num = H5E_CANTINIT; expected_g[1].maj_num = H5E_VOL; - expected_g[1].min_num = H5E_CANTINIT; + expected_g[1].min_num = H5E_CANTCREATE; - expected_g[2].maj_num = H5E_DATASET; - expected_g[2].min_num = H5E_CANTINIT; + expected_g[2].maj_num = H5E_VOL; + expected_g[2].min_num = H5E_CANTCREATE; expected_g[3].maj_num = H5E_DATASET; expected_g[3].min_num = H5E_CANTINIT; - expected_g[4].maj_num = H5E_LINK; + expected_g[4].maj_num = H5E_DATASET; expected_g[4].min_num = H5E_CANTINIT; expected_g[5].maj_num = H5E_LINK; - expected_g[5].min_num = H5E_CANTINSERT; + expected_g[5].min_num = H5E_CANTINIT; - expected_g[6].maj_num = H5E_SYM; - expected_g[6].min_num = H5E_NOTFOUND; + expected_g[6].maj_num = H5E_LINK; + expected_g[6].min_num = H5E_CANTINSERT; expected_g[7].maj_num = H5E_SYM; - expected_g[7].min_num = H5E_CALLBACK; + expected_g[7].min_num = H5E_NOTFOUND; - expected_g[8].maj_num = H5E_LINK; - expected_g[8].min_num = H5E_EXISTS; + expected_g[8].maj_num = H5E_SYM; + expected_g[8].min_num = H5E_CALLBACK; + + expected_g[9].maj_num = H5E_LINK; + expected_g[9].min_num = H5E_EXISTS; /* set up mutex for global count of errors */ H5TS_mutex_init(&error_mutex_g); @@ -121,7 +124,7 @@ tts_error(void) H5TS_wait_for_thread(threads[i]); if (error_flag_g) { - TestErrPrintf("At least one thread reported a value that was different from the exected value\n"); + TestErrPrintf("At least one thread reported a value that was different from the expected value\n"); HDprintf("(Update this test if the error stack changed!)\n"); } diff --git a/test/vds_swmr_gen.c b/test/vds_swmr_gen.c index 24c6131..1cb9744 100644 --- a/test/vds_swmr_gen.c +++ b/test/vds_swmr_gen.c @@ -61,7 +61,7 @@ main(void) map_start = 0; /* All SWMR files need to use the latest file format */ - if((faplid = H5Pcreate(H5P_FILE_ACCESS)) < 0) + if((faplid = h5_fileaccess()) < 0) TEST_ERROR if(H5Pset_libver_bounds(faplid, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR diff --git a/test/vds_swmr_reader.c b/test/vds_swmr_reader.c index 16f3abe..d0ec77b 100644 --- a/test/vds_swmr_reader.c +++ b/test/vds_swmr_reader.c @@ -18,6 +18,7 @@ int main(void) { hid_t fid = -1; /* HDF5 file ID */ + hid_t faplid = -1; /* file access property list ID */ hid_t did = -1; /* dataset ID */ hid_t msid = -1; /* memory dataspace ID */ hid_t fsid = -1; /* file dataspace ID */ @@ -34,7 +35,9 @@ main(void) /* Open the VDS file and dataset */ - if((fid = H5Fopen(VDS_FILE_NAME, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, H5P_DEFAULT)) < 0) + if((faplid = h5_fileaccess()) < 0) + TEST_ERROR + if((fid = H5Fopen(VDS_FILE_NAME, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, faplid)) < 0) TEST_ERROR if((did = H5Dopen2(fid, VDS_DSET_NAME, H5P_DEFAULT)) < 0) TEST_ERROR @@ -103,6 +106,8 @@ main(void) } while (dims[0] < N_PLANES_TO_WRITE); /* Close file and dataset */ + if(H5Pclose(faplid) < 0) + TEST_ERROR if(H5Sclose(msid) < 0) TEST_ERROR if(H5Dclose(did) < 0) @@ -120,6 +125,8 @@ error: H5E_BEGIN_TRY { if(fid >= 0) (void)H5Fclose(fid); + if(faplid >= 0) + (void)H5Pclose(faplid); if(did >= 0) (void)H5Dclose(did); if(msid >= 0) diff --git a/test/vds_swmr_writer.c b/test/vds_swmr_writer.c index 7824aa0..d62ecaf 100644 --- a/test/vds_swmr_writer.c +++ b/test/vds_swmr_writer.c @@ -56,7 +56,7 @@ main(int argc, char *argv[]) /* Open the source file and dataset */ /* All SWMR files need to use the latest file format */ - if((faplid = H5Pcreate(H5P_FILE_ACCESS)) < 0) + if((faplid = h5_fileaccess()) < 0) TEST_ERROR if(H5Pset_libver_bounds(faplid, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR @@ -43,11 +43,17 @@ static const H5VL_class_t fake_vol_g = { 0, /* version */ (H5VL_class_value_t)999, /* value */ FAKE_VOL_NAME, /* name */ + 0, /* capability flags */ NULL, /* initialize */ NULL, /* terminate */ - (size_t)0, /* fapl size */ - NULL, /* fapl copy */ - NULL, /* fapl free */ + (size_t)0, /* info size */ + NULL, /* info copy */ + NULL, /* info compare */ + NULL, /* info free */ + NULL, /* get_object */ + NULL, /* get_wrap_ctx */ + NULL, /* free_wrap_ctx */ + NULL, /* wrap_object */ { /* attribute_cls */ NULL, /* create */ NULL, /* open */ @@ -107,10 +113,12 @@ static const H5VL_class_t fake_vol_g = { NULL, /* specific */ NULL /* optional */ }, - { /* async_cls */ + { /* request_cls */ + NULL, /* wait */ NULL, /* cancel */ - NULL, /* test */ - NULL /* wait */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* free */ }, NULL /* optional */ }; @@ -120,7 +128,7 @@ static const H5VL_class_t fake_vol_g = { * Function: test_vol_registration() * * Purpose: Tests if we can load, register, and close a simple - * VOL driver. + * VOL connector. * * Return: SUCCEED/FAIL * @@ -130,28 +138,48 @@ static herr_t test_vol_registration(void) { htri_t is_registered; - hid_t vol_id = -1; + hid_t vol_id = -1, vol_id2 = -1; TESTING("VOL registration"); - /* The test/fake VOL driver should not be registered at the start of the test */ - if ((is_registered = H5VLis_driver_registered(FAKE_VOL_NAME)) < 0) + /* The test/fake VOL connector should not be registered at the start of the test */ + if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) FAIL_STACK_ERROR; if (is_registered > 0) - FAIL_PUTS_ERROR("native VOL driver is inappropriately registered"); + FAIL_PUTS_ERROR("native VOL connector is inappropriately registered"); /* Load a VOL interface */ - if ((vol_id = H5VLregister_driver(&fake_vol_g)) < 0) + if ((vol_id = H5VLregister_connector(&fake_vol_g, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR; + + /* The test/fake VOL connector should be registered now */ + if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) + FAIL_STACK_ERROR; + if (0 == is_registered) + FAIL_PUTS_ERROR("native VOL connector is un-registered"); + + /* Re-register a VOL connector */ + if ((vol_id2 = H5VLregister_connector(&fake_vol_g, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR; + + /* The test/fake VOL connector should still be registered now */ + if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) + FAIL_STACK_ERROR; + if (0 == is_registered) + FAIL_PUTS_ERROR("native VOL connector is un-registered"); + + /* Unregister the second test/fake VOL ID */ + if (H5VLunregister_connector(vol_id2) < 0) FAIL_STACK_ERROR; - /* The test/fake VOL driver should be registered now */ - if ((is_registered = H5VLis_driver_registered(FAKE_VOL_NAME)) < 0) + /* The test/fake VOL connector should still be registered now */ + if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0) FAIL_STACK_ERROR; if (0 == is_registered) - FAIL_PUTS_ERROR("native VOL driver is un-registered"); + FAIL_PUTS_ERROR("native VOL connector is un-registered"); - /* Close the VOL interface */ - if (H5VLclose(vol_id) < 0) + /* Unregister the original test/fake VOL ID */ + if (H5VLunregister_connector(vol_id) < 0) FAIL_STACK_ERROR; PASSED(); @@ -159,7 +187,7 @@ test_vol_registration(void) error: H5E_BEGIN_TRY { - H5VLclose(vol_id); + H5VLunregister_connector(vol_id); } H5E_END_TRY; return FAIL; @@ -169,7 +197,7 @@ error: /*------------------------------------------------------------------------- * Function: test_native_vol_init() * - * Purpose: Tests if the native VOL driver gets initialized. + * Purpose: Tests if the native VOL connector gets initialized. * * Return: SUCCEED/FAIL * @@ -180,13 +208,13 @@ test_native_vol_init(void) { htri_t is_registered; - TESTING("Native VOL driver initialization"); + TESTING("Native VOL connector initialization"); - /* The native VOL driver should always be registered */ - if ((is_registered = H5VLis_driver_registered(H5VL_NATIVE_NAME)) < 0) + /* The native VOL connector should always be registered */ + if ((is_registered = H5VLis_connector_registered(H5VL_NATIVE_NAME)) < 0) FAIL_STACK_ERROR; if (0 == is_registered) - FAIL_PUTS_ERROR("native VOL driver is un-registered"); + FAIL_PUTS_ERROR("native VOL connector is un-registered"); PASSED(); return SUCCEED; @@ -200,7 +228,7 @@ error: /*------------------------------------------------------------------------- * Function: test_basic_file_operation() * - * Purpose: Uses the native VOL driver to test basic VOL file operations + * Purpose: Uses the native VOL connector to test basic VOL file operations * * Return: SUCCEED/FAIL * @@ -321,7 +349,7 @@ error: /*------------------------------------------------------------------------- * Function: test_basic_group_operation() * - * Purpose: Uses the native VOL driver to test basic VOL group operations + * Purpose: Uses the native VOL connector to test basic VOL group operations * * Return: SUCCEED/FAIL * @@ -412,7 +440,7 @@ error: /*------------------------------------------------------------------------- * Function: test_basic_dataset_operation() * - * Purpose: Uses the native VOL driver to test basic VOL dataset operations + * Purpose: Uses the native VOL connector to test basic VOL dataset operations * * Return: SUCCEED/FAIL * @@ -581,7 +609,7 @@ error: /*------------------------------------------------------------------------- * Function: test_basic_attribute_operation() * - * Purpose: Uses the native VOL driver to test basic VOL attribute operations + * Purpose: Uses the native VOL connector to test basic VOL attribute operations * * Return: SUCCEED/FAIL * @@ -679,7 +707,7 @@ error: /*------------------------------------------------------------------------- * Function: test_basic_object_operation() * - * Purpose: Uses the native VOL driver to test basic VOL object operations + * Purpose: Uses the native VOL connector to test basic VOL object operations * * Return: SUCCEED/FAIL * @@ -743,7 +771,7 @@ error: /*------------------------------------------------------------------------- * Function: test_basic_link_operation() * - * Purpose: Uses the native VOL driver to test basic VOL link operations + * Purpose: Uses the native VOL connector to test basic VOL link operations * * Return: SUCCEED/FAIL * @@ -808,7 +836,7 @@ error: /*------------------------------------------------------------------------- * Function: test_basic_datatype_operation() * - * Purpose: Uses the native VOL driver to test basic VOL datatype operations + * Purpose: Uses the native VOL connector to test basic VOL datatype operations * * Return: SUCCEED/FAIL * @@ -890,7 +918,7 @@ error: /*------------------------------------------------------------------------- * Function: test_echo_vol_operation() * - * Purpose: Uses the echo VOL driver to test basic VOL operations + * Purpose: Uses the echo VOL connector to test basic VOL operations * via the H5VL public API. * * Return: SUCCEED/FAIL diff --git a/tools/test/h5dump/errfiles/filter_fail.err b/tools/test/h5dump/errfiles/filter_fail.err index 6c936b7..07b0aa0 100644 --- a/tools/test/h5dump/errfiles/filter_fail.err +++ b/tools/test/h5dump/errfiles/filter_fail.err @@ -2,25 +2,28 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dread(): can't read data major: Dataset minor: Read failed - #001: (file name) line (number) in H5VL_dataset_read(): read failed + #001: (file name) line (number) in H5VL_dataset_read(): dataset read failed major: Virtual Object Layer minor: Read failed - #002: (file name) line (number) in H5VL_native_dataset_read(): can't read data + #002: (file name) line (number) in H5VL__dataset_read(): dataset read failed + major: Virtual Object Layer + minor: Read failed + #003: (file name) line (number) in H5VL__native_dataset_read(): can't read data major: Dataset minor: Read failed - #003: (file name) line (number) in H5D__read(): can't read data + #004: (file name) line (number) in H5D__read(): can't read data major: Dataset minor: Read failed - #004: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk + #005: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk major: Low-level I/O minor: Read failed - #005: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed + #006: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed major: Dataset minor: Filter operation failed - #006: (file name) line (number) in H5Z_pipeline(): required filter 'filter_fail_test' is not registered + #007: (file name) line (number) in H5Z_pipeline(): required filter 'filter_fail_test' is not registered major: Data filters minor: Read failed - #007: (file name) line (number) in H5PL_load(): filter plugins disabled + #008: (file name) line (number) in H5PL_load(): filter plugins disabled major: Plugin for dynamically loaded library minor: Unable to load metadata into cache h5dump error: unable to print data diff --git a/tools/test/h5dump/errfiles/tall-1.err b/tools/test/h5dump/errfiles/tall-1.err index 64d5aca..2d2b289 100644 --- a/tools/test/h5dump/errfiles/tall-1.err +++ b/tools/test/h5dump/errfiles/tall-1.err @@ -2,33 +2,36 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #003: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A.err b/tools/test/h5dump/errfiles/tall-2A.err index 64d5aca..2d2b289 100644 --- a/tools/test/h5dump/errfiles/tall-2A.err +++ b/tools/test/h5dump/errfiles/tall-2A.err @@ -2,33 +2,36 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #003: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A0.err b/tools/test/h5dump/errfiles/tall-2A0.err index 64d5aca..2d2b289 100644 --- a/tools/test/h5dump/errfiles/tall-2A0.err +++ b/tools/test/h5dump/errfiles/tall-2A0.err @@ -2,33 +2,36 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #003: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2B.err b/tools/test/h5dump/errfiles/tall-2B.err index 64d5aca..2d2b289 100644 --- a/tools/test/h5dump/errfiles/tall-2B.err +++ b/tools/test/h5dump/errfiles/tall-2B.err @@ -2,33 +2,36 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #003: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tarray1_big.err b/tools/test/h5dump/errfiles/tarray1_big.err index b2cc6b7..ff22495 100644 --- a/tools/test/h5dump/errfiles/tarray1_big.err +++ b/tools/test/h5dump/errfiles/tarray1_big.err @@ -2,39 +2,48 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object - #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object - #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object - #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/tattr-3.err b/tools/test/h5dump/errfiles/tattr-3.err index 3190c3d..8481acf 100644 --- a/tools/test/h5dump/errfiles/tattr-3.err +++ b/tools/test/h5dump/errfiles/tattr-3.err @@ -5,13 +5,16 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_attr_open(): attribute open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_attr_open(): unable to open attribute: 'attr' + #002: (file name) line (number) in H5VL__attr_open(): attribute open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_attr_open(): unable to open attribute: 'attr' major: Attribute minor: Can't open object - #003: (file name) line (number) in H5A__open(): unable to load attribute info from object header for attribute: 'attr' + #004: (file name) line (number) in H5A__open(): unable to load attribute info from object header for attribute: 'attr' major: Attribute minor: Can't open object - #004: (file name) line (number) in H5O__attr_open_by_name(): can't locate attribute: 'attr' + #005: (file name) line (number) in H5O__attr_open_by_name(): can't locate attribute: 'attr' major: Attribute minor: Object not found h5dump error: unable to open attribute "attr" diff --git a/tools/test/h5dump/errfiles/tattrregR.err b/tools/test/h5dump/errfiles/tattrregR.err index d89b053..8a1539c 100644 --- a/tools/test/h5dump/errfiles/tattrregR.err +++ b/tools/test/h5dump/errfiles/tattrregR.err @@ -2,26 +2,32 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object - #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object - #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/tcomp-3.err b/tools/test/h5dump/errfiles/tcomp-3.err index 3462761..fc59b0b 100644 --- a/tools/test/h5dump/errfiles/tcomp-3.err +++ b/tools/test/h5dump/errfiles/tcomp-3.err @@ -2,24 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Topen2(): unable to open named datatype major: Datatype minor: Can't open object - #001: (file name) line (number) in H5VL_datatype_open(): open failed + #001: (file name) line (number) in H5VL_datatype_open(): datatype open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_datatype_open(): unable to open named datatype + #002: (file name) line (number) in H5VL__datatype_open(): datatype open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_datatype_open(): unable to open named datatype major: Datatype minor: Can't open object - #003: (file name) line (number) in H5T__open_name(): not found + #004: (file name) line (number) in H5T__open_name(): not found major: Datatype minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #007: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #007: (file name) line (number) in H5G__loc_find_cb(): object '#6632' doesn't exist + #008: (file name) line (number) in H5G__loc_find_cb(): object '#6632' doesn't exist major: Symbol table minor: Object not found diff --git a/tools/test/h5dump/errfiles/tdataregR.err b/tools/test/h5dump/errfiles/tdataregR.err index d89b053..8a1539c 100644 --- a/tools/test/h5dump/errfiles/tdataregR.err +++ b/tools/test/h5dump/errfiles/tdataregR.err @@ -2,26 +2,32 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object - #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Rdereference2(): unable to dereference object major: References minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to dereference object + #003: (file name) line (number) in H5VL__native_object_open(): unable to dereference object major: References minor: Can't open object - #003: (file name) line (number) in H5R__dereference(): Undefined reference pointer + #004: (file name) line (number) in H5R__dereference(): Undefined reference pointer major: Invalid arguments to routine minor: Bad value H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/tdset-2.err b/tools/test/h5dump/errfiles/tdset-2.err index b2a60cd..2d70b35 100644 --- a/tools/test/h5dump/errfiles/tdset-2.err +++ b/tools/test/h5dump/errfiles/tdset-2.err @@ -5,44 +5,50 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_dataset_open(): dataset open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_dataset_open(): unable to open dataset + #002: (file name) line (number) in H5VL__dataset_open(): dataset open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_dataset_open(): unable to open dataset major: Dataset minor: Can't open object - #003: (file name) line (number) in H5D__open_name(): not found + #004: (file name) line (number) in H5D__open_name(): not found major: Dataset minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #007: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #007: (file name) line (number) in H5G__loc_find_cb(): object 'dset3' doesn't exist + #008: (file name) line (number) in H5G__loc_find_cb(): object 'dset3' doesn't exist major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info major: Links minor: Can't get value - #001: (file name) line (number) in H5VL_link_get(): get failed + #001: (file name) line (number) in H5VL_link_get(): link get failed major: Virtual Object Layer minor: Can't get value - #002: (file name) line (number) in H5VL_native_link_get(): unable to get link info + #002: (file name) line (number) in H5VL__link_get(): link get failed + major: Virtual Object Layer + minor: Can't get value + #003: (file name) line (number) in H5VL__native_link_get(): unable to get link info major: Links minor: Object not found - #003: (file name) line (number) in H5L_get_info(): name doesn't exist + #004: (file name) line (number) in H5L_get_info(): name doesn't exist major: Links minor: Object already exists - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #006: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #006: (file name) line (number) in H5L__get_info_cb(): name doesn't exist + #007: (file name) line (number) in H5L__get_info_cb(): name doesn't exist major: Links minor: Object not found h5dump error: unable to get link info from "dset3" diff --git a/tools/test/h5dump/errfiles/textlink.err b/tools/test/h5dump/errfiles/textlink.err index f516638..aaf3144 100644 --- a/tools/test/h5dump/errfiles/textlink.err +++ b/tools/test/h5dump/errfiles/textlink.err @@ -2,67 +2,73 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #003: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename' major: Links minor: Unable to open file - #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'filename', temp_file_name = 'filename' + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'filename', temp_file_name = 'filename' major: File accessibility minor: Unable to open file HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #002: (file name) line (number) in H5VL__object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #003: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile' major: Links minor: Unable to open file - #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'anotherfile', temp_file_name = 'anotherfile' + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'anotherfile', temp_file_name = 'anotherfile' major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/textlinkfar.err b/tools/test/h5dump/errfiles/textlinkfar.err index ba06406..8245291 100644 --- a/tools/test/h5dump/errfiles/textlinkfar.err +++ b/tools/test/h5dump/errfiles/textlinkfar.err @@ -2,55 +2,58 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #003: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #009: (file name) line (number) in H5L__extern_traverse(): unable to open object + #010: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object - #010: (file name) line (number) in H5O_open_name(): object not found + #011: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #011: (file name) line (number) in H5G_loc_find(): can't find object + #012: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #012: (file name) line (number) in H5G_traverse(): internal path traversal failed + #013: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #013: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #014: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #014: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed + #015: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed major: Links minor: Link traversal failure - #015: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link + #016: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link major: Symbol table minor: Object not found - #016: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #017: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #017: (file name) line (number) in H5G__traverse_slink_cb(): component not found + #018: (file name) line (number) in H5G__traverse_slink_cb(): component not found major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/textlinksrc.err b/tools/test/h5dump/errfiles/textlinksrc.err index ba06406..8245291 100644 --- a/tools/test/h5dump/errfiles/textlinksrc.err +++ b/tools/test/h5dump/errfiles/textlinksrc.err @@ -2,55 +2,58 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #003: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #009: (file name) line (number) in H5L__extern_traverse(): unable to open object + #010: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object - #010: (file name) line (number) in H5O_open_name(): object not found + #011: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #011: (file name) line (number) in H5G_loc_find(): can't find object + #012: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #012: (file name) line (number) in H5G_traverse(): internal path traversal failed + #013: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #013: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #014: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #014: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed + #015: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed major: Links minor: Link traversal failure - #015: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link + #016: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link major: Symbol table minor: Object not found - #016: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #017: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #017: (file name) line (number) in H5G__traverse_slink_cb(): component not found + #018: (file name) line (number) in H5G__traverse_slink_cb(): component not found major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/tgroup-2.err b/tools/test/h5dump/errfiles/tgroup-2.err index af220b8..27557f3 100644 --- a/tools/test/h5dump/errfiles/tgroup-2.err +++ b/tools/test/h5dump/errfiles/tgroup-2.err @@ -2,25 +2,28 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Gopen2(): unable to open group major: Symbol table minor: Can't open object - #001: (file name) line (number) in H5VL_group_open(): open failed + #001: (file name) line (number) in H5VL_group_open(): group open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_group_open(): unable to open group + #002: (file name) line (number) in H5VL__group_open(): group open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_group_open(): unable to open group major: Symbol table minor: Can't open object - #003: (file name) line (number) in H5G__open_name(): group not found + #004: (file name) line (number) in H5G__open_name(): group not found major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #007: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #007: (file name) line (number) in H5G__loc_find_cb(): object 'y' doesn't exist + #008: (file name) line (number) in H5G__loc_find_cb(): object 'y' doesn't exist major: Symbol table minor: Object not found h5dump error: unable to open group "/y" diff --git a/tools/test/h5dump/errfiles/torderlinks1.err b/tools/test/h5dump/errfiles/torderlinks1.err index 1336de5..ce31ced 100644 --- a/tools/test/h5dump/errfiles/torderlinks1.err +++ b/tools/test/h5dump/errfiles/torderlinks1.err @@ -2,33 +2,36 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #003: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file - #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/torderlinks2.err b/tools/test/h5dump/errfiles/torderlinks2.err index 1336de5..ce31ced 100644 --- a/tools/test/h5dump/errfiles/torderlinks2.err +++ b/tools/test/h5dump/errfiles/torderlinks2.err @@ -2,33 +2,36 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5VL_object_open(): open failed + #001: (file name) line (number) in H5VL_object_open(): object open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_object_open(): unable to open object by name + #002: (file name) line (number) in H5VL__object_open(): object open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_object_open(): unable to open object by name major: Object header minor: Can't open object - #003: (file name) line (number) in H5O_open_name(): object not found + #004: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #009: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #009: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' + #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file - #010: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' + #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' major: File accessibility minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tperror.err b/tools/test/h5dump/errfiles/tperror.err index 4df7265..b0b908b 100644 --- a/tools/test/h5dump/errfiles/tperror.err +++ b/tools/test/h5dump/errfiles/tperror.err @@ -5,44 +5,50 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_dataset_open(): dataset open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_dataset_open(): unable to open dataset + #002: (file name) line (number) in H5VL__dataset_open(): dataset open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_dataset_open(): unable to open dataset major: Dataset minor: Can't open object - #003: (file name) line (number) in H5D__open_name(): not found + #004: (file name) line (number) in H5D__open_name(): not found major: Dataset minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #007: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #007: (file name) line (number) in H5G__loc_find_cb(): object 'bogus' doesn't exist + #008: (file name) line (number) in H5G__loc_find_cb(): object 'bogus' doesn't exist major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info major: Links minor: Can't get value - #001: (file name) line (number) in H5VL_link_get(): get failed + #001: (file name) line (number) in H5VL_link_get(): link get failed major: Virtual Object Layer minor: Can't get value - #002: (file name) line (number) in H5VL_native_link_get(): unable to get link info + #002: (file name) line (number) in H5VL__link_get(): link get failed + major: Virtual Object Layer + minor: Can't get value + #003: (file name) line (number) in H5VL__native_link_get(): unable to get link info major: Links minor: Object not found - #003: (file name) line (number) in H5L_get_info(): name doesn't exist + #004: (file name) line (number) in H5L_get_info(): name doesn't exist major: Links minor: Object already exists - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #005: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #006: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #006: (file name) line (number) in H5L__get_info_cb(): name doesn't exist + #007: (file name) line (number) in H5L__get_info_cb(): name doesn't exist major: Links minor: Object not found h5dump error: unable to get link info from "bogus" diff --git a/tools/test/h5dump/errfiles/tslink-D.err b/tools/test/h5dump/errfiles/tslink-D.err index ded6719..e650a33 100644 --- a/tools/test/h5dump/errfiles/tslink-D.err +++ b/tools/test/h5dump/errfiles/tslink-D.err @@ -5,30 +5,33 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in H5VL_dataset_open(): dataset open failed major: Virtual Object Layer minor: Can't open object - #002: (file name) line (number) in H5VL_native_dataset_open(): unable to open dataset + #002: (file name) line (number) in H5VL__dataset_open(): dataset open failed + major: Virtual Object Layer + minor: Can't open object + #003: (file name) line (number) in H5VL__native_dataset_open(): unable to open dataset major: Dataset minor: Can't open object - #003: (file name) line (number) in H5D__open_name(): not found + #004: (file name) line (number) in H5D__open_name(): not found major: Dataset minor: Object not found - #004: (file name) line (number) in H5G_loc_find(): can't find object + #005: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G_traverse(): internal path traversal failed + #006: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #006: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #007: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed + #008: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed major: Links minor: Link traversal failure - #008: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link + #009: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link major: Symbol table minor: Object not found - #009: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #010: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #010: (file name) line (number) in H5G__traverse_slink_cb(): component not found + #011: (file name) line (number) in H5G__traverse_slink_cb(): component not found major: Symbol table minor: Object not found diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst b/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst index 6009723..4e69148 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst @@ -2,40 +2,43 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dcreate2(): unable to create dataset major: Dataset minor: Unable to initialize object - #001: (file name) line (number) in H5VL_dataset_create(): create failed + #001: (file name) line (number) in H5VL_dataset_create(): dataset create failed major: Virtual Object Layer - minor: Unable to initialize object - #002: (file name) line (number) in H5VL_native_dataset_create(): unable to create dataset + minor: Unable to create file + #002: (file name) line (number) in H5VL__dataset_create(): dataset create failed + major: Virtual Object Layer + minor: Unable to create file + #003: (file name) line (number) in H5VL__native_dataset_create(): unable to create dataset major: Dataset minor: Unable to initialize object - #003: (file name) line (number) in H5D__create_named(): unable to create and link to dataset + #004: (file name) line (number) in H5D__create_named(): unable to create and link to dataset major: Dataset minor: Unable to initialize object - #004: (file name) line (number) in H5L_link_object(): unable to create new link to object + #005: (file name) line (number) in H5L_link_object(): unable to create new link to object major: Links minor: Unable to initialize object - #005: (file name) line (number) in H5L__create_real(): can't insert link + #006: (file name) line (number) in H5L__create_real(): can't insert link major: Links minor: Unable to insert object - #006: (file name) line (number) in H5G_traverse(): internal path traversal failed + #007: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #007: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #008: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #008: (file name) line (number) in H5L__link_cb(): unable to create object + #009: (file name) line (number) in H5L__link_cb(): unable to create object major: Links minor: Unable to initialize object - #009: (file name) line (number) in H5O_obj_create(): unable to open object + #010: (file name) line (number) in H5O_obj_create(): unable to open object major: Object header minor: Can't open object - #010: (file name) line (number) in H5O__dset_create(): unable to create dataset + #011: (file name) line (number) in H5O__dset_create(): unable to create dataset major: Dataset minor: Unable to initialize object - #011: (file name) line (number) in H5D__create(): unable to construct layout information + #012: (file name) line (number) in H5D__create(): unable to construct layout information major: Dataset minor: Unable to initialize object - #012: (file name) line (number) in H5D__chunk_construct(): dimensionality of chunks doesn't match the dataspace + #013: (file name) line (number) in H5D__chunk_construct(): dimensionality of chunks doesn't match the dataspace major: Dataset minor: Bad value H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): |