diff options
Diffstat (limited to 'examples/h5dsm_group_create.c')
-rw-r--r-- | examples/h5dsm_group_create.c | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/examples/h5dsm_group_create.c b/examples/h5dsm_group_create.c index e5c3d49..e60be79 100644 --- a/examples/h5dsm_group_create.c +++ b/examples/h5dsm_group_create.c @@ -2,15 +2,15 @@ int main(int argc, char *argv[]) { uuid_t pool_uuid; - char *pool_grp = "daos_tier0"; - hid_t file = -1, grp = -1, trans = -1, fapl = -1; - uint64_t trans_num; + char *pool_grp = NULL; + hid_t file = -1, grp = -1, fapl = -1; + H5VL_daosm_snap_id_t snap_id; (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,33 +23,26 @@ int main(int argc, char *argv[]) { ERROR; /* Open file */ - if((file = H5Fopen_ff(argv[2], H5F_ACC_RDWR, fapl, &trans)) < 0) + if((file = H5Fopen(argv[2], H5F_ACC_RDWR, fapl)) < 0) ERROR; - /* Get next transaction */ - if(H5TRget_trans_num(trans, &trans_num) < 0) - ERROR; - if(H5TRclose(trans) < 0) - ERROR; - if((trans = H5TRcreate(file, trans_num + 1)) < 0) - ERROR; - - printf("Creating group - transaction number = %llu\n", (long long unsigned)(trans_num + 1)); + printf("Creating group\n"); /* Create group */ - if((grp = H5Gcreate_ff(file, argv[3], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT, trans)) < 0) + if((grp = H5Gcreate2(file, argv[3], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) ERROR; - /* Commit transaction */ - if(H5TRcommit(trans) < 0) - ERROR; + /* Save snapshot if requested */ + if(argc == 5) { + if(H5VLdaosm_snap_create(file, &snap_id) < 0) + ERROR; + printf("Saved snapshot: snap_id = %llu\n", (long long unsigned)snap_id); + } /* end if */ /* Close */ - if(H5Gclose_ff(grp, -1) < 0) - ERROR; - if(H5TRclose(trans) < 0) + if(H5Gclose(grp) < 0) ERROR; - if(H5Fclose_ff(file, -1) < 0) + if(H5Fclose(file) < 0) ERROR; if(H5Pclose(fapl) < 0) ERROR; @@ -62,9 +55,8 @@ int main(int argc, char *argv[]) { error: H5E_BEGIN_TRY { - H5Gclose_ff(grp, -1); - H5TRclose(trans); - H5Fclose_ff(file, -1); + H5Gclose(grp); + H5Fclose(file); H5Pclose(fapl); } H5E_END_TRY; |