diff options
author | Neil Fortner <nfortne2@hdfgroup.org> | 2016-12-12 22:41:39 (GMT) |
---|---|---|
committer | Neil Fortner <nfortne2@hdfgroup.org> | 2016-12-12 22:41:39 (GMT) |
commit | 3889eeb5c86376fa677d48c8156584435f5cea66 (patch) | |
tree | 4e4d4b5850b8d3f6a4a409f3d64ec512f70b5ec3 /examples/h5dsm_group_open.c | |
parent | bbcb31845f506a167337c432c062a01936fe7118 (diff) | |
download | hdf5-3889eeb5c86376fa677d48c8156584435f5cea66.zip hdf5-3889eeb5c86376fa677d48c8156584435f5cea66.tar.gz hdf5-3889eeb5c86376fa677d48c8156584435f5cea66.tar.bz2 |
Add transaction number printing for write examples, optional transaction
number arguments for read examples. Rework and fix bug in
h5dsm_dset_wpartial.c. Not tested.
Diffstat (limited to 'examples/h5dsm_group_open.c')
-rw-r--r-- | examples/h5dsm_group_open.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/examples/h5dsm_group_open.c b/examples/h5dsm_group_open.c index 4031ff2..6dc4144 100644 --- a/examples/h5dsm_group_open.c +++ b/examples/h5dsm_group_open.c @@ -5,12 +5,13 @@ int main(int argc, char *argv[]) { char *pool_grp = "daos_tier0"; hid_t file = -1, grp = -1, trans = -1, fapl = -1; hsize_t dims[1] = {1}; + uint64_t trans_num; (void)MPI_Init(&argc, &argv); (void)daos_init(); - if(argc != 4) - PRINTF_ERROR("argc != 4\n"); + if(argc < 4 || argc > 5) + PRINTF_ERROR("argc must be 4 or 5\n"); /* Parse UUID */ if(0 != uuid_parse(argv[1], pool_uuid)) @@ -23,9 +24,21 @@ int main(int argc, char *argv[]) { ERROR; /* Open file */ - if((file = H5Fopen_ff(argv[2], H5F_ACC_RDONLY, fapl, &trans)) < 0) + if((file = H5Fopen_ff(argv[2], H5F_ACC_RDONLY, fapl, argc == 4 ? &trans : NULL)) < 0) ERROR; + /* Create transaction if specified */ + if(argc == 5) { + trans_num = (uint64_t)atoi(argv[4]); + if((trans = H5TRcreate(file, trans_num)) < 0) + ERROR; + } + else + if(H5TRget_trans_num(trans, &trans_num) < 0) + ERROR; + + printf("Opening group - transaction number = %llu\n", (long long unsigned)trans_num); + /* Open group */ if((grp = H5Gopen_ff(file, argv[3], H5P_DEFAULT, trans)) < 0) ERROR; |