From 7a5e632c0dd6735269728328aa63a040e0d72e6e Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 30 Oct 2018 10:32:17 -0700 Subject: Cleaned up VOL example. --- examples/h5_vol_external_log_native.c | 145 +++++++++++++++------------------- 1 file changed, 62 insertions(+), 83 deletions(-) diff --git a/examples/h5_vol_external_log_native.c b/examples/h5_vol_external_log_native.c index d3a5dbd..26bae30 100644 --- a/examples/h5_vol_external_log_native.c +++ b/examples/h5_vol_external_log_native.c @@ -52,63 +52,63 @@ static const H5VL_class_t H5VL_log_g = { NULL, NULL, { /* attribute_cls */ - NULL, //H5VL_log_attr_create, /* create */ - NULL, //H5VL_log_attr_open, /* open */ - NULL, //H5VL_log_attr_read, /* read */ - NULL, //H5VL_log_attr_write, /* write */ - NULL, //H5VL_log_attr_get, /* get */ - NULL, //H5VL_log_attr_specific, /* specific */ - NULL, //H5VL_log_attr_optional, /* optional */ - NULL //H5VL_log_attr_close /* close */ + NULL, /* H5VL_log_attr_create, */ /* create */ + NULL, /* H5VL_log_attr_open, */ /* open */ + NULL, /* H5VL_log_attr_read, */ /* read */ + NULL, /* H5VL_log_attr_write, */ /* write */ + NULL, /* H5VL_log_attr_get, */ /* get */ + NULL, /* H5VL_log_attr_specific, */ /* specific */ + NULL, /* H5VL_log_attr_optional, */ /* optional */ + NULL /* H5VL_log_attr_close */ /* close */ }, { /* dataset_cls */ H5VL_log_dataset_create, /* create */ H5VL_log_dataset_open, /* open */ H5VL_log_dataset_read, /* read */ H5VL_log_dataset_write, /* write */ - NULL, //H5VL_log_dataset_get, /* get */ - NULL, //H5VL_log_dataset_specific, /* specific */ - NULL, //H5VL_log_dataset_optional, /* optional */ + NULL, /* H5VL_log_dataset_get, */ /* get */ + NULL, /* H5VL_log_dataset_specific, */ /* specific */ + NULL, /* H5VL_log_dataset_optional, */ /* optional */ H5VL_log_dataset_close /* close */ }, { /* datatype_cls */ H5VL_log_datatype_commit, /* commit */ H5VL_log_datatype_open, /* open */ H5VL_log_datatype_get, /* get_size */ - NULL, //H5VL_log_datatype_specific, /* specific */ - NULL, //H5VL_log_datatype_optional, /* optional */ + NULL, /* H5VL_log_datatype_specific, */ /* specific */ + NULL, /* H5VL_log_datatype_optional, */ /* optional */ H5VL_log_datatype_close /* close */ }, { /* file_cls */ - H5VL_log_file_create, /* create */ - H5VL_log_file_open, /* open */ - H5VL_log_file_get, /* get */ - NULL, //H5VL_log_file_specific, /* specific */ - NULL, //H5VL_log_file_optional, /* optional */ - H5VL_log_file_close /* close */ + H5VL_log_file_create, /* create */ + H5VL_log_file_open, /* open */ + H5VL_log_file_get, /* get */ + NULL, /* H5VL_log_file_specific, */ /* specific */ + NULL, /* H5VL_log_file_optional, */ /* optional */ + H5VL_log_file_close /* close */ }, { /* group_cls */ - H5VL_log_group_create, /* create */ - NULL, //H5VL_log_group_open, /* open */ - NULL, //H5VL_log_group_get, /* get */ - NULL, //H5VL_log_group_specific, /* specific */ - NULL, //H5VL_log_group_optional, /* optional */ - H5VL_log_group_close /* close */ + H5VL_log_group_create, /* create */ + NULL, /* H5VL_log_group_open, */ /* open */ + NULL, /* H5VL_log_group_get, */ /* get */ + NULL, /* H5VL_log_group_specific, */ /* specific */ + NULL, /* H5VL_log_group_optional, */ /* optional */ + H5VL_log_group_close /* close */ }, { /* link_cls */ - NULL, //H5VL_log_link_create, /* create */ - NULL, //H5VL_log_link_copy, /* copy */ - NULL, //H5VL_log_link_move, /* move */ - NULL, //H5VL_log_link_get, /* get */ - NULL, //H5VL_log_link_specific, /* specific */ - NULL, //H5VL_log_link_optional, /* optional */ + NULL, /* H5VL_log_link_create, */ /* create */ + NULL, /* H5VL_log_link_copy, */ /* copy */ + NULL, /* H5VL_log_link_move, */ /* move */ + NULL, /* H5VL_log_link_get, */ /* get */ + NULL, /* H5VL_log_link_specific, */ /* specific */ + NULL, /* H5VL_log_link_optional, */ /* optional */ }, { /* object_cls */ - H5VL_log_object_open, /* open */ - NULL, //H5VL_log_object_copy, /* copy */ - NULL, //H5VL_log_object_get, /* get */ - H5VL_log_object_specific, /* specific */ - NULL, //H5VL_log_object_optional, /* optional */ + H5VL_log_object_open, /* open */ + NULL, /* H5VL_log_object_copy, */ /* copy */ + NULL, /* H5VL_log_object_get, */ /* get */ + H5VL_log_object_specific, /* specific */ + NULL, /* H5VL_log_object_optional, */ /* optional */ }, { NULL, @@ -123,8 +123,7 @@ typedef struct H5VL_log_t { } H5VL_log_t; static herr_t -visit_cb(hid_t oid, const char *name, - const H5O_info_t *oinfo, void *udata) +visit_cb(hid_t oid, const char *name, const H5O_info_t *oinfo, void *udata) { ssize_t len; char n[25]; @@ -139,9 +138,11 @@ visit_cb(hid_t oid, const char *name, printf("visiting datatype\n"); return 1; -} /* end h5_verify_cached_stabs_cb() */ +} -int main(int argc, char **argv) { +int +main(int argc, char **argv) +{ const char file_name[]="large_dataset.h5"; const char group_name[]="/Group"; const char dataset_name[]="Data"; @@ -184,33 +185,33 @@ int main(int argc, char **argv) { 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); + printf("FILE VOL name = %s %lu\n", name, (unsigned long)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); + printf("GROUP VOL name = %s %lu\n", name, (unsigned long)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); + printf("DT COMMIT name = %s %lu\n", name, (unsigned long)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); + printf("DT OPEN name = %s %lu\n", name, (unsigned long)len); H5Tclose(int_id); int_id = H5Oopen(file_id,"int",H5P_DEFAULT); len = H5VLget_driver_name(int_id, name, 50); - printf ("DT OOPEN name = %s %lu\n", name, (unsigned long)len); + printf("DT OPEN name = %s %lu\n", name, (unsigned long)len); len = H5Fget_name(file_id, name, 50); printf("name = %lu %s\n", (unsigned long)len, name); - data = malloc (sizeof(int)*nelem); - for(i=0;i