diff options
Diffstat (limited to 'examples/h5dsm_file_open.c')
-rw-r--r-- | examples/h5dsm_file_open.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/examples/h5dsm_file_open.c b/examples/h5dsm_file_open.c index b3846d0..3a1d399 100644 --- a/examples/h5dsm_file_open.c +++ b/examples/h5dsm_file_open.c @@ -4,12 +4,13 @@ int main(int argc, char *argv[]) { uuid_t pool_uuid; char *pool_grp = NULL; hid_t file = -1, fapl = -1; + H5VL_daosm_snap_id_t snap_id; (void)MPI_Init(&argc, &argv); (void)daos_init(); - if(argc != 3) - PRINTF_ERROR("argc != 3\n"); + if(argc < 3 || argc > 4) + PRINTF_ERROR("argc must be 3 or 4\n"); /* Parse UUID */ if(0 != uuid_parse(argv[1], pool_uuid)) @@ -21,6 +22,14 @@ int main(int argc, char *argv[]) { if(H5Pset_fapl_daosm(fapl, MPI_COMM_WORLD, MPI_INFO_NULL, pool_uuid, pool_grp) < 0) ERROR; + /* Open snapshot if specified */ + if(argc == 4) { + snap_id = (H5VL_daosm_snap_id_t)atoi(argv[3]); + printf("Opening snapshot %llu\n", (long long unsigned)snap_id); + if(H5Pset_daosm_snap_open(fapl, snap_id) < 0) + ERROR; + } /* end if */ + /* Open file */ if((file = H5Fopen_ff(argv[2], H5F_ACC_RDONLY, fapl, NULL)) < 0) ERROR; |