summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2018-10-25 23:32:13 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2018-10-25 23:32:13 (GMT)
commit4a328957243ca7502a4c4966d6598498be43e3cd (patch)
treeb46c66d7532db54cdf010b577b9bdfcd9b2dbc8c /examples
parent0df6e44a6e68da1614cf80b50ed7b208edaa5df7 (diff)
parent47f30b474bdc498c20bd6d2a0ba7e8947ab389f0 (diff)
downloadhdf5-4a328957243ca7502a4c4966d6598498be43e3cd.zip
hdf5-4a328957243ca7502a4c4966d6598498be43e3cd.tar.gz
hdf5-4a328957243ca7502a4c4966d6598498be43e3cd.tar.bz2
Merge branch 'develop' of https://bitbucket.hdfgroup.org/scm/hdffv/hdf5 into stackable_vol
Diffstat (limited to 'examples')
-rw-r--r--examples/h5_vol_external_log_native.c199
-rw-r--r--examples/run-c-ex.sh.in4
2 files changed, 94 insertions, 109 deletions
diff --git a/examples/h5_vol_external_log_native.c b/examples/h5_vol_external_log_native.c
index 3f819e7..1a6685c 100644
--- a/examples/h5_vol_external_log_native.c
+++ b/examples/h5_vol_external_log_native.c
@@ -137,7 +137,7 @@ visit_cb(hid_t oid, const char *name,
if(H5Iget_type(oid) == H5I_GROUP) {
len = H5VLget_plugin_name(oid, n, 50);
- printf ("Visiting GROUP VOL name = %s %d\n", n, len);
+ printf ("Visiting GROUP VOL name = %s %zd\n", n, len);
}
if(H5Iget_type(oid) == H5I_DATASET)
printf("visiting dataset\n");
@@ -148,120 +148,103 @@ visit_cb(hid_t oid, const char *name,
} /* end h5_verify_cached_stabs_cb() */
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;
- hid_t datasetId;
- hid_t acc_tpl;
- hid_t under_fapl;
- hid_t vol_id;
- hid_t int_id;
- hid_t attr;
- hid_t space;
- const unsigned int nelem=60;
- int *data;
- unsigned int i;
- hsize_t dims[1];
- ssize_t len;
- char name[25];
- static hsize_t ds_size[2] = {10, 20};
-
- under_fapl = H5Pcreate (H5P_FILE_ACCESS);
- H5Pset_fapl_native(under_fapl);
- assert(H5VLis_registered("native") == 1);
-
- vol_id = H5VLregister (&H5VL_log_g, H5P_DEFAULT);
- assert(vol_id > 0);
- assert(H5VLis_registered("log") == 1);
-
- native_plugin_id = H5VLget_plugin_id("native");
- assert(native_plugin_id > 0);
-
- acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
- H5Pset_vol(acc_tpl, vol_id, &under_fapl);
-
- file_id = H5Fcreate(file_name, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl);
- len = H5VLget_plugin_name(file_id, name, 25);
- printf ("FILE VOL name = %s %d\n", name, len);
-
- group_id = H5Gcreate2(file_id, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- len = H5VLget_plugin_name(group_id, name, 50);
- printf ("GROUP VOL name = %s %d\n", name, len);
-
- int_id = H5Tcopy(H5T_NATIVE_INT);
- H5Tcommit2(file_id, "int", int_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- len = H5VLget_plugin_name(int_id, name, 50);
- printf ("DT COMMIT name = %s %d\n", name, len);
- H5Tclose(int_id);
-
- int_id = H5Topen2(file_id, "int", H5P_DEFAULT);
- len = H5VLget_plugin_name(int_id, name, 50);
- printf ("DT OPEN name = %s %d\n", name, len);
- H5Tclose(int_id);
-
- int_id = H5Oopen(file_id,"int",H5P_DEFAULT);
- len = H5VLget_plugin_name(int_id, name, 50);
- printf ("DT OOPEN name = %s %d\n", name, len);
-
- len = H5Fget_name(file_id, name, 50);
- printf("name = %d %s\n", len, name);
-
- data = malloc (sizeof(int)*nelem);
- for(i=0;i<nelem;++i)
- data[i]=i;
-
- dims [0] = 60;
- dataspaceId = H5Screate_simple(1, dims, NULL);
- space = H5Screate_simple (2, ds_size, ds_size);
-
- sprintf(fullpath,"%s/%s",group_name,dataset_name);
- datasetId = H5Dcreate2(file_id,fullpath,H5T_NATIVE_INT,dataspaceId,H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
- H5Sclose(dataspaceId);
-
- len = H5VLget_plugin_name(datasetId, name, 50);
- printf ("DSET name = %s %d\n", name, len);
-
- H5Dwrite(datasetId, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
- H5Dclose(datasetId);
-
- H5Ovisit2(file_id, H5_INDEX_NAME, H5_ITER_NATIVE, visit_cb, NULL, H5O_INFO_ALL);
-
- free (data);
- H5Oclose(int_id);
- H5Sclose (space);
- H5Gclose(group_id);
-#if 0
+ 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;
+ hid_t datasetId;
+ hid_t acc_tpl;
+ hid_t under_fapl;
+ hid_t vol_id, vol_id2;
+ hid_t int_id;
+ hid_t attr;
+ hid_t space;
+ const unsigned int nelem=60;
+ int *data;
+ unsigned int i;
+ hsize_t dims[1];
+ ssize_t len;
+ char name[25];
+ static hsize_t ds_size[2] = {10, 20};
- attr = H5Acreate2(group_id, "attr1", int_id, space, H5P_DEFAULT, H5P_DEFAULT);
- int_id = H5Aget_type(attr);
- len = H5VLget_plugin_name(int_id, name, 50);
- printf ("DT OPEN name = %s %d\n", name, len);
+ under_fapl = H5Pcreate(H5P_FILE_ACCESS);
+ H5Pset_fapl_native(under_fapl);
+ assert(H5VLis_plugin_registered("native") == 1);
- H5Aclose (attr);
+ vol_id = H5VLregister_plugin(&H5VL_log_g);
+ assert(vol_id > 0);
+ assert(H5VLis_plugin_registered("log") == 1);
- int_id = H5Oopen(file_id,"int",H5P_DEFAULT);
- len = H5VLget_plugin_name(int_id, name, 50);
- printf ("DT OOPEN name = %s %d\n", name, len);
- H5Oclose(int_id);
+ vol_id2 = H5VLget_plugin_id("log");
+ H5VLclose(vol_id2);
+ native_plugin_id = H5VLget_plugin_id("native");
+ assert(native_plugin_id > 0);
- H5Fclose(file_id);
- file_id = H5Fopen(file_name, H5F_ACC_RDWR, H5P_DEFAULT);//acc_tpl);
- H5Fflush(file_id, H5F_SCOPE_GLOBAL);
-#endif
+ 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_plugin_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_plugin_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_plugin_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_plugin_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_plugin_name(int_id, name, 50);
+ printf ("DT OOPEN name = %s %zd\n", name, len);
- H5Fclose(file_id);
- H5Pclose(acc_tpl);
- H5Pclose(under_fapl);
+ len = H5Fget_name(file_id, name, 50);
+ printf("name = %zd %s\n", len, name);
- H5VLunregister(native_plugin_id);
- H5VLunregister (vol_id);
- assert(H5VLis_registered("log") == 0);
- return 0;
+ data = malloc (sizeof(int)*nelem);
+ for(i=0;i<nelem;++i)
+ data[i]=i;
+
+ dims [0] = 60;
+ dataspaceId = H5Screate_simple(1, dims, NULL);
+ space = H5Screate_simple (2, ds_size, ds_size);
+
+ sprintf(fullpath,"%s/%s",group_name,dataset_name);
+ datasetId = H5Dcreate2(file_id,fullpath,H5T_NATIVE_INT,dataspaceId,H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
+ H5Sclose(dataspaceId);
+
+ len = H5VLget_plugin_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);
+
+ H5Ovisit2(file_id, H5_INDEX_NAME, H5_ITER_NATIVE, visit_cb, NULL, H5O_INFO_ALL);
+
+ free (data);
+ H5Oclose(int_id);
+ H5Sclose (space);
+ H5Gclose(group_id);
+ H5Fclose(file_id);
+ H5Pclose(acc_tpl);
+ H5Pclose(under_fapl);
+
+ H5VLclose(native_plugin_id);
+ H5VLunregister_driver(vol_id);
+ assert(H5VLis_plugin_registered("log") == 0);
+ return 0;
}
static herr_t H5VL_log_init(hid_t vipl_id)
diff --git a/examples/run-c-ex.sh.in b/examples/run-c-ex.sh.in
index 209cdd7..6ff2e9a 100644
--- a/examples/run-c-ex.sh.in
+++ b/examples/run-c-ex.sh.in
@@ -139,7 +139,9 @@ then
RunTest h5_vds-percival-unlim-maxmin&&\
rm h5_vds-percival-unlim-maxmin &&\
RunTest h5_vds &&\
- rm h5_vds); then
+ rm h5_vds &&\
+ RunTest h5_vol_external_log_native &&\
+ rm h5_vol_external_log_native); then
EXIT_VALUE=${EXIT_SUCCESS}
else
EXIT_VALUE=${EXIT_FAILURE}