diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/h5_extlink.c | 4 | ||||
-rw-r--r-- | examples/h5_vol_external_log_native.c | 132 |
2 files changed, 71 insertions, 65 deletions
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"); |