From 509f1d5060d2d3e2753c2b835102668275dd0a69 Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Tue, 9 May 2017 16:14:35 -0500 Subject: Add support for H5Aget_name, H5Aget_creatE_plist, H5Aget_space, and H5Aget_type. Update h5dsm_attr_open.c to test these functions. Minor improvemetns to h5dsm_test.sh. --- examples/h5dsm_attr_open.c | 71 ++++++++++++- examples/h5dsm_test.sh | 255 +++++++++++++++++++++++---------------------- src/H5VLdaosm.c | 133 ++++++++++++++++++++--- 3 files changed, 317 insertions(+), 142 deletions(-) diff --git a/examples/h5dsm_attr_open.c b/examples/h5dsm_attr_open.c index 30eb075..d1a0c80 100644 --- a/examples/h5dsm_attr_open.c +++ b/examples/h5dsm_attr_open.c @@ -3,7 +3,13 @@ int main(int argc, char *argv[]) { uuid_t pool_uuid; char *pool_grp = NULL; - hid_t file = -1, attr = -1, fapl = -1; + hid_t file = -1, attr = -1, fapl = -1, space = -1, type = -1, acpl = -1, def_acpl = -1; + int ndims; + hsize_t dims[2]; + char *name_buf = NULL; + size_t name_buf_size = 0; + ssize_t ssize_ret; + htri_t tri_ret; H5VL_daosm_snap_id_t snap_id; (void)MPI_Init(&argc, &argv); @@ -45,6 +51,55 @@ int main(int argc, char *argv[]) { if((attr = H5Aopen_by_name(file, argv[3], argv[4], H5P_DEFAULT, H5P_DEFAULT)) < 0) ERROR; + /* Check attribute dataspace */ + if((space = H5Aget_space(attr)) < 0) + ERROR; + if((ndims = H5Sget_simple_extent_ndims(space)) < 0) + ERROR; + if(ndims != 2) + PRINTF_ERROR("ndims == %d, expected 2\n", ndims); + if(H5Sget_simple_extent_dims(space, dims, NULL) < 0) + ERROR; + if(dims[0] != 4) + PRINTF_ERROR("dims[0] == %d, expected 4\n", (int)dims[0]); + if(dims[1] != 6) + PRINTF_ERROR("dims[1] == %d, expected 6\n", (int)dims[1]); + + /* Check attribute datatype */ + if((type = H5Aget_type(attr)) < 0) + ERROR; + if((tri_ret = H5Tequal(type, H5T_NATIVE_INT)) < 0) + ERROR; + if(!tri_ret) + PRINTF_ERROR("datatype does not equal H5T_NATIVE_INT\n"); + + /* Check ACPL */ + if((acpl = H5Aget_create_plist(attr)) < 0) + ERROR; + if((def_acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) < 0) + ERROR; + if((tri_ret = H5Pequal(acpl, def_acpl)) < 0) + ERROR; + if(!tri_ret) + PRINTF_ERROR("ACPL does not equal default\n"); + + /* Check attribute name */ + if((ssize_ret = H5Aget_name(attr, 0, NULL)) < 0) + ERROR; + name_buf_size = strlen(argv[4]) + 1; + if(ssize_ret != (ssize_t)name_buf_size - 1) + PRINTF_ERROR("unexpected attribute name size"); + if(NULL == (name_buf = malloc(name_buf_size))) + ERROR; + if((ssize_ret = H5Aget_name(attr, name_buf_size, name_buf)) < 0) + ERROR; + if(ssize_ret != (ssize_t)name_buf_size - 1) + PRINTF_ERROR("unexpected attribute name size"); + if(name_buf[name_buf_size - 1] != '\0') + PRINTF_ERROR("attribute name not terminated"); + if(strcmp(name_buf, argv[4])) + PRINTF_ERROR("attribute name does not match"); + /* Close */ if(H5Aclose(attr) < 0) ERROR; @@ -52,6 +107,15 @@ int main(int argc, char *argv[]) { ERROR; if(H5Pclose(fapl) < 0) ERROR; + if(H5Sclose(space) < 0) + ERROR; + if(H5Tclose(type) < 0) + ERROR; + if(H5Pclose(acpl) < 0) + ERROR; + if(H5Pclose(def_acpl) < 0) + ERROR; + free(name_buf); printf("Success\n"); @@ -63,7 +127,12 @@ error: H5Aclose(attr); H5Fclose(file); H5Pclose(fapl); + H5Sclose(space); + H5Tclose(type); + H5Pclose(acpl); + H5Pclose(def_acpl); } H5E_END_TRY; + free(name_buf); (void)MPI_Finalize(); return 1; diff --git a/examples/h5dsm_test.sh b/examples/h5dsm_test.sh index d82d77f..2abfe52 100755 --- a/examples/h5dsm_test.sh +++ b/examples/h5dsm_test.sh @@ -1,101 +1,102 @@ POOL_UUID=$1 -EXEC_ARGS="-x DD_MASK=\"all\" --hostfile $HOME/my_hosts --ompi-server file:~/uri.txt" +EXEC_ARGS="-x DD_MASK=\"all\" --ompi-server file:~/uri.txt" +FILE="h5dsm_test.h5" # --------------- SETUP --------------- # # Create file -echo h5dsm_file_create file.h5 -orterun -np 1 $EXEC_ARGS ./h5dsm_file_create $POOL_UUID file.h5 +echo h5dsm_file_create $FILE +orterun -np 1 $EXEC_ARGS ./h5dsm_file_create $POOL_UUID $FILE if test $? -ne 0; then echo FAILED exit 1 fi -echo h5dsm_file_create file.h5 \(2 processes\) -orterun -np 2 $EXEC_ARGS ./h5dsm_file_create $POOL_UUID file.h5 +echo h5dsm_file_create $FILE \(2 processes\) +orterun -np 2 $EXEC_ARGS ./h5dsm_file_create $POOL_UUID $FILE if test $? -ne 0; then echo FAILED exit 1 fi # Open file -echo h5dsm_file_open file.h5 -orterun -np 1 $EXEC_ARGS ./h5dsm_file_open $POOL_UUID file.h5 +echo h5dsm_file_open $FILE +orterun -np 1 $EXEC_ARGS ./h5dsm_file_open $POOL_UUID $FILE if test $? -ne 0; then echo FAILED exit 1 fi -echo h5dsm_file_open file.h5 \(2 processes\) -orterun -np 2 $EXEC_ARGS ./h5dsm_file_open $POOL_UUID file.h5 +echo h5dsm_file_open $FILE \(2 processes\) +orterun -np 2 $EXEC_ARGS ./h5dsm_file_open $POOL_UUID $FILE if test $? -ne 0; then echo FAILED exit 1 fi # Create group -echo h5dsm_group_create file.h5 grp -orterun -np 1 $EXEC_ARGS ./h5dsm_group_create $POOL_UUID file.h5 grp +echo h5dsm_group_create $FILE grp +orterun -np 1 $EXEC_ARGS ./h5dsm_group_create $POOL_UUID $FILE grp if test $? -ne 0; then echo FAILED exit 1 fi # Open group -echo h5dsm_group_open file.h5 grp -orterun -np 1 $EXEC_ARGS ./h5dsm_group_open $POOL_UUID file.h5 grp +echo h5dsm_group_open $FILE grp +orterun -np 1 $EXEC_ARGS ./h5dsm_group_open $POOL_UUID $FILE grp if test $? -ne 0; then echo FAILED exit 1 fi -echo h5dsm_group_open file.h5 grp \(2 processes\) -orterun -np 2 $EXEC_ARGS ./h5dsm_group_open $POOL_UUID file.h5 grp +echo h5dsm_group_open $FILE grp \(2 processes\) +orterun -np 2 $EXEC_ARGS ./h5dsm_group_open $POOL_UUID $FILE grp if test $? -ne 0; then echo FAILED exit 1 fi # Create dataset -echo h5dsm_dset_create file.h5 dset -orterun -np 1 $EXEC_ARGS ./h5dsm_dset_create $POOL_UUID file.h5 dset +echo h5dsm_dset_create $FILE dset +orterun -np 1 $EXEC_ARGS ./h5dsm_dset_create $POOL_UUID $FILE dset if test $? -ne 0; then echo FAILED exit 1 fi # Create dset2 -echo h5dsm_dset_create file.h5 dset2 \(2 processes\) -orterun -np 2 $EXEC_ARGS ./h5dsm_dset_create $POOL_UUID file.h5 dset2 +echo h5dsm_dset_create $FILE dset2 \(2 processes\) +orterun -np 2 $EXEC_ARGS ./h5dsm_dset_create $POOL_UUID $FILE dset2 if test $? -ne 0; then echo FAILED exit 1 fi # Open dataset -echo h5dsm_dset_open file.h5 /dset -orterun -np 1 $EXEC_ARGS ./h5dsm_dset_open $POOL_UUID file.h5 dset +echo h5dsm_dset_open $FILE /dset +orterun -np 1 $EXEC_ARGS ./h5dsm_dset_open $POOL_UUID $FILE dset if test $? -ne 0; then echo FAILED exit 1 fi -echo h5dsm_dset_open file.h5 /dset \(2 processes\) -orterun -np 1 $EXEC_ARGS ./h5dsm_dset_open $POOL_UUID file.h5 dset +echo h5dsm_dset_open $FILE /dset \(2 processes\) +orterun -np 1 $EXEC_ARGS ./h5dsm_dset_open $POOL_UUID $FILE dset if test $? -ne 0; then echo FAILED exit 1 fi # Open dset2 -echo h5dsm_dset_open file.h5 dset2 -orterun -np 1 $EXEC_ARGS ./h5dsm_dset_open $POOL_UUID file.h5 dset2 +echo h5dsm_dset_open $FILE dset2 +orterun -np 1 $EXEC_ARGS ./h5dsm_dset_open $POOL_UUID $FILE dset2 if test $? -ne 0; then echo FAILED exit 1 fi -echo h5dsm_dset_open file.h5 dset2 \(2 processes\) -orterun -np 1 $EXEC_ARGS ./h5dsm_dset_open $POOL_UUID file.h5 dset2 +echo h5dsm_dset_open $FILE dset2 \(2 processes\) +orterun -np 1 $EXEC_ARGS ./h5dsm_dset_open $POOL_UUID $FILE dset2 if test $? -ne 0; then echo FAILED exit 1 @@ -103,32 +104,32 @@ fi # --------------- DSET IO --------------- # # Write dataset -echo h5dsm_dset_write file.h5 dset -orterun -np 1 $EXEC_ARGS ./h5dsm_dset_write $POOL_UUID file.h5 dset +echo h5dsm_dset_write $FILE dset +orterun -np 1 $EXEC_ARGS ./h5dsm_dset_write $POOL_UUID $FILE dset if test $? -ne 0; then echo FAILED exit 1 fi # "Write Partial" test -echo h5dsm_dset_wpartial file.h5 dset2 \(2 processes\) -orterun -np 2 $EXEC_ARGS ./h5dsm_dset_wpartial $POOL_UUID file.h5 dset2 +echo h5dsm_dset_wpartial $FILE dset2 \(2 processes\) +orterun -np 2 $EXEC_ARGS ./h5dsm_dset_wpartial $POOL_UUID $FILE dset2 if test $? -ne 0; then echo FAILED exit 1 fi # Read dataset -echo h5dsm_dset_read file.h5 dset2 -orterun -np 1 $EXEC_ARGS ./h5dsm_dset_read $POOL_UUID file.h5 dset2 +echo h5dsm_dset_read $FILE dset2 +orterun -np 1 $EXEC_ARGS ./h5dsm_dset_read $POOL_UUID $FILE dset2 if test $? -ne 0; then echo FAILED exit 1 fi # "Read Partial" test -echo h5dsm_dset_rpartial file.h5 dset \(2 processes\) -orterun -np 2 $EXEC_ARGS ./h5dsm_dset_rpartial $POOL_UUID file.h5 dset +echo h5dsm_dset_rpartial $FILE dset \(2 processes\) +orterun -np 2 $EXEC_ARGS ./h5dsm_dset_rpartial $POOL_UUID $FILE dset if test $? -ne 0; then echo FAILED exit 1 @@ -136,125 +137,125 @@ fi # --------------- LINKS --------------- # # H5Lexists (should be FALSE) -echo h5dsm_link_exists file.h5 grp2 -orterun -np 1 $EXEC_ARGS ./h5dsm_link_exists $POOL_UUID file.h5 grp2 | tee h5dsm_test.out +echo h5dsm_link_exists $FILE grp2 +orterun -np 1 $EXEC_ARGS ./h5dsm_link_exists $POOL_UUID $FILE grp2 | tee h5dsm_test.out if test $? -ne 0; then echo FAILED exit 1 fi # Create grp2 \(2 processes\) -echo h5dsm_group_create file.h5 grp2 -s -orterun -np 2 $EXEC_ARGS ./h5dsm_group_create $POOL_UUID file.h5 grp2 -s +echo h5dsm_group_create $FILE grp2 -s +orterun -np 2 $EXEC_ARGS ./h5dsm_group_create $POOL_UUID $FILE grp2 -s if test $? -ne 0; then echo FAILED exit 1 fi # H5Lexists (should be TRUE) -echo h5dsm_link_exists file.h5 grp2 -orterun -np 1 $EXEC_ARGS ./h5dsm_link_exists $POOL_UUID file.h5 grp2 | tee -a h5dsm_test.out +echo h5dsm_link_exists $FILE grp2 +orterun -np 1 $EXEC_ARGS ./h5dsm_link_exists $POOL_UUID $FILE grp2 | tee -a h5dsm_test.out if test $? -ne 0; then echo FAILED exit 1 fi # Create slink -echo h5dsm_slink_create file.h5 grp slink -s -orterun -np 1 $EXEC_ARGS ./h5dsm_slink_create $POOL_UUID file.h5 grp slink -s +echo h5dsm_slink_create $FILE grp slink -s +orterun -np 1 $EXEC_ARGS ./h5dsm_slink_create $POOL_UUID $FILE grp slink -s if test $? -ne 0; then echo FAILED exit 1 fi # Open slink -echo h5dsm_group_open file.h5 slink -orterun -np 1 $EXEC_ARGS ./h5dsm_group_open $POOL_UUID file.h5 slink +echo h5dsm_group_open $FILE slink +orterun -np 1 $EXEC_ARGS ./h5dsm_group_open $POOL_UUID $FILE slink if test $? -ne 0; then echo FAILED exit 1 fi -echo h5dsm_group_open file.h5 slink \(2 processes\) -orterun -np 2 $EXEC_ARGS ./h5dsm_group_open $POOL_UUID file.h5 slink +echo h5dsm_group_open $FILE slink \(2 processes\) +orterun -np 2 $EXEC_ARGS ./h5dsm_group_open $POOL_UUID $FILE slink if test $? -ne 0; then echo FAILED exit 1 fi # Create slroot -echo h5dsm_slink_create file.h5 / grp/slroot -orterun -np 1 $EXEC_ARGS ./h5dsm_slink_create $POOL_UUID file.h5 / grp/slroot +echo h5dsm_slink_create $FILE / grp/slroot +orterun -np 1 $EXEC_ARGS ./h5dsm_slink_create $POOL_UUID $FILE / grp/slroot if test $? -ne 0; then echo FAILED exit 1 fi # Open slroot -echo h5dsm_group_open file.h5 /slink/slroot/grp -orterun -np 1 $EXEC_ARGS ./h5dsm_group_open $POOL_UUID file.h5 /slink/slroot/grp +echo h5dsm_group_open $FILE /slink/slroot/grp +orterun -np 1 $EXEC_ARGS ./h5dsm_group_open $POOL_UUID $FILE /slink/slroot/grp if test $? -ne 0; then echo FAILED exit 1 fi -echo h5dsm_group_open file.h5 /slink/slroot/grp \(2 processes\) -orterun -np 2 $EXEC_ARGS ./h5dsm_group_open $POOL_UUID file.h5 /slink/slroot/grp +echo h5dsm_group_open $FILE /slink/slroot/grp \(2 processes\) +orterun -np 2 $EXEC_ARGS ./h5dsm_group_open $POOL_UUID $FILE /slink/slroot/grp if test $? -ne 0; then echo FAILED exit 1 fi # H5Lexists (should be FALSE) -echo h5dsm_link_exists file.h5 /slink/slroot/slpath -orterun -np 1 $EXEC_ARGS ./h5dsm_link_exists $POOL_UUID file.h5 /slink/slroot/slpath | tee -a h5dsm_test.out +echo h5dsm_link_exists $FILE /slink/slroot/slpath +orterun -np 1 $EXEC_ARGS ./h5dsm_link_exists $POOL_UUID $FILE /slink/slroot/slpath | tee -a h5dsm_test.out if test $? -ne 0; then echo FAILED exit 1 fi # Create slpath -echo h5dsm_slink_create file.h5 /slink/slroot/dset slpath -orterun -np 1 $EXEC_ARGS ./h5dsm_slink_create $POOL_UUID file.h5 /slink/slroot/dset slpath +echo h5dsm_slink_create $FILE /slink/slroot/dset slpath +orterun -np 1 $EXEC_ARGS ./h5dsm_slink_create $POOL_UUID $FILE /slink/slroot/dset slpath if test $? -ne 0; then echo FAILED exit 1 fi # H5Lexists (should be TRUE) -echo h5dsm_link_exists file.h5 /slink/slroot/slpath -orterun -np 1 $EXEC_ARGS ./h5dsm_link_exists $POOL_UUID file.h5 /slink/slroot/slpath | tee -a h5dsm_test.out +echo h5dsm_link_exists $FILE /slink/slroot/slpath +orterun -np 1 $EXEC_ARGS ./h5dsm_link_exists $POOL_UUID $FILE /slink/slroot/slpath | tee -a h5dsm_test.out if test $? -ne 0; then echo FAILED exit 1 fi # Open slpath -echo h5dsm_dset_open file.h5 slink/slroot/slpath -orterun -np 1 $EXEC_ARGS ./h5dsm_group_open $POOL_UUID file.h5 slpath +echo h5dsm_dset_open $FILE slink/slroot/slpath +orterun -np 1 $EXEC_ARGS ./h5dsm_group_open $POOL_UUID $FILE slpath if test $? -ne 0; then echo FAILED exit 1 fi -echo h5dsm_dset_open file.h5 slink/slroot/slpath \(2 processes\) -orterun -np 2 $EXEC_ARGS ./h5dsm_group_open $POOL_UUID file.h5 slpath +echo h5dsm_dset_open $FILE slink/slroot/slpath \(2 processes\) +orterun -np 2 $EXEC_ARGS ./h5dsm_group_open $POOL_UUID $FILE slpath if test $? -ne 0; then echo FAILED exit 1 fi # H5Literate root -echo h5dsm_link_iter file.h5 / -orterun -np 1 $EXEC_ARGS ./h5dsm_link_iter $POOL_UUID file.h5 / | tee -a h5dsm_test.out +echo h5dsm_link_iter $FILE / +orterun -np 1 $EXEC_ARGS ./h5dsm_link_iter $POOL_UUID $FILE / | tee -a h5dsm_test.out if test $? -ne 0; then echo FAILED exit 1 fi # H5Literate grp -echo h5dsm_link_iter file.h5 grp -orterun -np 1 $EXEC_ARGS ./h5dsm_link_iter $POOL_UUID file.h5 grp | tee -a h5dsm_test.out +echo h5dsm_link_iter $FILE grp +orterun -np 1 $EXEC_ARGS ./h5dsm_link_iter $POOL_UUID $FILE grp | tee -a h5dsm_test.out if test $? -ne 0; then echo FAILED exit 1 @@ -262,104 +263,104 @@ fi # --------------- Attributes --------------- # # Create attribute on root group -echo h5dsm_attr_create file.h5 / attrroot -orterun -np 1 $EXEC_ARGS ./h5dsm_attr_create $POOL_UUID file.h5 / attrroot +echo h5dsm_attr_create $FILE / attrroot +orterun -np 1 $EXEC_ARGS ./h5dsm_attr_create $POOL_UUID $FILE / attrroot if test $? -ne 0; then echo FAILED exit 1 fi # Open attribute -echo h5dsm_attr_open file.h5 / attrroot -orterun -np 1 $EXEC_ARGS ./h5dsm_attr_open $POOL_UUID file.h5 / attrroot +echo h5dsm_attr_open $FILE / attrroot +orterun -np 1 $EXEC_ARGS ./h5dsm_attr_open $POOL_UUID $FILE / attrroot if test $? -ne 0; then echo FAILED exit 1 fi # Write attribute -echo h5dsm_attr_write file.h5 / attrroot -orterun -np 1 $EXEC_ARGS ./h5dsm_attr_write $POOL_UUID file.h5 / attrroot +echo h5dsm_attr_write $FILE / attrroot +orterun -np 1 $EXEC_ARGS ./h5dsm_attr_write $POOL_UUID $FILE / attrroot if test $? -ne 0; then echo FAILED exit 1 fi # Read attribute -echo h5dsm_attr_read file.h5 / attrroot -orterun -np 1 $EXEC_ARGS ./h5dsm_attr_read $POOL_UUID file.h5 / attrroot +echo h5dsm_attr_read $FILE / attrroot +orterun -np 1 $EXEC_ARGS ./h5dsm_attr_read $POOL_UUID $FILE / attrroot if test $? -ne 0; then echo FAILED exit 1 fi # Create attribute on group -echo h5dsm_attr_create file.h5 grp attrgrp -orterun -np 1 $EXEC_ARGS ./h5dsm_attr_create $POOL_UUID file.h5 grp attrgrp +echo h5dsm_attr_create $FILE grp attrgrp +orterun -np 1 $EXEC_ARGS ./h5dsm_attr_create $POOL_UUID $FILE grp attrgrp if test $? -ne 0; then echo FAILED exit 1 fi # Open attribute -echo h5dsm_attr_open file.h5 /grp attrgrp -orterun -np 1 $EXEC_ARGS ./h5dsm_attr_open $POOL_UUID file.h5 /grp attrgrp +echo h5dsm_attr_open $FILE /grp attrgrp +orterun -np 1 $EXEC_ARGS ./h5dsm_attr_open $POOL_UUID $FILE /grp attrgrp if test $? -ne 0; then echo FAILED exit 1 fi # Create attribute on dataset -echo h5dsm_attr_create file.h5 /dset attrdset -orterun -np 1 $EXEC_ARGS ./h5dsm_attr_create $POOL_UUID file.h5 /dset attrdset +echo h5dsm_attr_create $FILE /dset attrdset +orterun -np 1 $EXEC_ARGS ./h5dsm_attr_create $POOL_UUID $FILE /dset attrdset if test $? -ne 0; then echo FAILED exit 1 fi # Open attribute -echo h5dsm_attr_open file.h5 dset attrdset -orterun -np 1 $EXEC_ARGS ./h5dsm_attr_open $POOL_UUID file.h5 dset attrdset +echo h5dsm_attr_open $FILE dset attrdset +orterun -np 1 $EXEC_ARGS ./h5dsm_attr_open $POOL_UUID $FILE dset attrdset if test $? -ne 0; then echo FAILED exit 1 fi # Create additional attribute on root group -echo h5dsm_attr_create file.h5 / attrroot2 -orterun -np 1 $EXEC_ARGS ./h5dsm_attr_create $POOL_UUID file.h5 / attrroot2 +echo h5dsm_attr_create $FILE / attrroot2 +orterun -np 1 $EXEC_ARGS ./h5dsm_attr_create $POOL_UUID $FILE / attrroot2 if test $? -ne 0; then echo FAILED exit 1 fi # Open attribute -echo h5dsm_attr_open file.h5 / attrroot2 -orterun -np 1 $EXEC_ARGS ./h5dsm_attr_open $POOL_UUID file.h5 / attrroot2 +echo h5dsm_attr_open $FILE / attrroot2 +orterun -np 1 $EXEC_ARGS ./h5dsm_attr_open $POOL_UUID $FILE / attrroot2 if test $? -ne 0; then echo FAILED exit 1 fi # H5Aiterate on root group -echo h5dsm_attr_iter file.h5 / -orterun -np 1 $EXEC_ARGS ./h5dsm_attr_iter $POOL_UUID file.h5 / | tee -a h5dsm_test.out +echo h5dsm_attr_iter $FILE / +orterun -np 1 $EXEC_ARGS ./h5dsm_attr_iter $POOL_UUID $FILE / | tee -a h5dsm_test.out if test $? -ne 0; then echo FAILED exit 1 fi # H5Aiterate on group -echo h5dsm_attr_iter file.h5 grp -orterun -np 1 $EXEC_ARGS ./h5dsm_attr_iter $POOL_UUID file.h5 grp | tee -a h5dsm_test.out +echo h5dsm_attr_iter $FILE grp +orterun -np 1 $EXEC_ARGS ./h5dsm_attr_iter $POOL_UUID $FILE grp | tee -a h5dsm_test.out if test $? -ne 0; then echo FAILED exit 1 fi # H5Aiterate on dataset -echo h5dsm_attr_iter file.h5 /dset -orterun -np 1 $EXEC_ARGS ./h5dsm_attr_iter $POOL_UUID file.h5 /dset | tee -a h5dsm_test.out +echo h5dsm_attr_iter $FILE /dset +orterun -np 1 $EXEC_ARGS ./h5dsm_attr_iter $POOL_UUID $FILE /dset | tee -a h5dsm_test.out if test $? -ne 0; then echo FAILED exit 1 @@ -367,114 +368,114 @@ fi # --------------- Objects --------------- # # H5Oopen root group -echo h5dsm_obj_open file.h5 / -orterun -np 1 $EXEC_ARGS ./h5dsm_obj_open $POOL_UUID file.h5 / +echo h5dsm_obj_open $FILE / +orterun -np 1 $EXEC_ARGS ./h5dsm_obj_open $POOL_UUID $FILE / if test $? -ne 0; then echo FAILED exit 1 fi -echo h5dsm_obj_open file.h5 / \(2 processes\) -orterun -np 2 $EXEC_ARGS ./h5dsm_obj_open $POOL_UUID file.h5 / +echo h5dsm_obj_open $FILE / \(2 processes\) +orterun -np 2 $EXEC_ARGS ./h5dsm_obj_open $POOL_UUID $FILE / if test $? -ne 0; then echo FAILED exit 1 fi # H5Oopen group -echo h5dsm_obj_open file.h5 /grp -orterun -np 1 $EXEC_ARGS ./h5dsm_obj_open $POOL_UUID file.h5 /grp +echo h5dsm_obj_open $FILE /grp +orterun -np 1 $EXEC_ARGS ./h5dsm_obj_open $POOL_UUID $FILE /grp if test $? -ne 0; then echo FAILED exit 1 fi -echo h5dsm_obj_open file.h5 /grp \(2 processes\) -orterun -np 2 $EXEC_ARGS ./h5dsm_obj_open $POOL_UUID file.h5 /grp +echo h5dsm_obj_open $FILE /grp \(2 processes\) +orterun -np 2 $EXEC_ARGS ./h5dsm_obj_open $POOL_UUID $FILE /grp if test $? -ne 0; then echo FAILED exit 1 fi # H5Oopen dataset -echo h5dsm_obj_open file.h5 dset -orterun -np 1 $EXEC_ARGS ./h5dsm_obj_open $POOL_UUID file.h5 dset +echo h5dsm_obj_open $FILE dset +orterun -np 1 $EXEC_ARGS ./h5dsm_obj_open $POOL_UUID $FILE dset if test $? -ne 0; then echo FAILED exit 1 fi -echo h5dsm_obj_open file.h5 dset \(2 processes\) -orterun -np 2 $EXEC_ARGS ./h5dsm_obj_open $POOL_UUID file.h5 dset +echo h5dsm_obj_open $FILE dset \(2 processes\) +orterun -np 2 $EXEC_ARGS ./h5dsm_obj_open $POOL_UUID $FILE dset if test $? -ne 0; then echo FAILED exit 1 fi # H5Oget_info root group -echo h5dsm_obj_info file.h5 / -orterun -np 1 $EXEC_ARGS ./h5dsm_obj_info $POOL_UUID file.h5 / | tee -a h5dsm_test.out +echo h5dsm_obj_info $FILE / +orterun -np 1 $EXEC_ARGS ./h5dsm_obj_info $POOL_UUID $FILE / | tee -a h5dsm_test.out if test $? -ne 0; then echo FAILED exit 1 fi # H5Oget_info group -echo h5dsm_obj_info file.h5 grp -orterun -np 1 $EXEC_ARGS ./h5dsm_obj_info $POOL_UUID file.h5 grp | tee -a h5dsm_test.out +echo h5dsm_obj_info $FILE grp +orterun -np 1 $EXEC_ARGS ./h5dsm_obj_info $POOL_UUID $FILE grp | tee -a h5dsm_test.out if test $? -ne 0; then echo FAILED exit 1 fi # H5Oget_info dataset -echo h5dsm_obj_info file.h5 /dset -orterun -np 1 $EXEC_ARGS ./h5dsm_obj_info $POOL_UUID file.h5 /dset | tee -a h5dsm_test.out +echo h5dsm_obj_info $FILE /dset +orterun -np 1 $EXEC_ARGS ./h5dsm_obj_info $POOL_UUID $FILE /dset | tee -a h5dsm_test.out if test $? -ne 0; then echo FAILED exit 1 fi # H5Oopen_by_addr root group -echo h5dsm_obj_open_addr file.h5 0x0000000000000001 -orterun -np 1 $EXEC_ARGS ./h5dsm_obj_open_addr $POOL_UUID file.h5 0x0000000000000001 +echo h5dsm_obj_open_addr $FILE 0x0000000000000001 +orterun -np 1 $EXEC_ARGS ./h5dsm_obj_open_addr $POOL_UUID $FILE 0x0000000000000001 if test $? -ne 0; then echo FAILED exit 1 fi -echo h5dsm_obj_open_addr file.h5 0x0000000000000001 \(2 processes\) -orterun -np 2 $EXEC_ARGS ./h5dsm_obj_open_addr $POOL_UUID file.h5 0x0000000000000001 +echo h5dsm_obj_open_addr $FILE 0x0000000000000001 \(2 processes\) +orterun -np 2 $EXEC_ARGS ./h5dsm_obj_open_addr $POOL_UUID $FILE 0x0000000000000001 if test $? -ne 0; then echo FAILED exit 1 fi # H5Oopen_by_addr group -echo h5dsm_obj_open_addr file.h5 0x0000000000000002 -orterun -np 1 $EXEC_ARGS ./h5dsm_obj_open_addr $POOL_UUID file.h5 0x0000000000000002 +echo h5dsm_obj_open_addr $FILE 0x0000000000000002 +orterun -np 1 $EXEC_ARGS ./h5dsm_obj_open_addr $POOL_UUID $FILE 0x0000000000000002 if test $? -ne 0; then echo FAILED exit 1 fi -echo h5dsm_obj_open_addr file.h5 0x0000000000000002 \(2 processes\) -orterun -np 2 $EXEC_ARGS ./h5dsm_obj_open_addr $POOL_UUID file.h5 0x0000000000000002 +echo h5dsm_obj_open_addr $FILE 0x0000000000000002 \(2 processes\) +orterun -np 2 $EXEC_ARGS ./h5dsm_obj_open_addr $POOL_UUID $FILE 0x0000000000000002 if test $? -ne 0; then echo FAILED exit 1 fi # H5Oopen_by_addr dataset -echo h5dsm_obj_open_addr file.h5 0x4000000000000003 -orterun -np 1 $EXEC_ARGS ./h5dsm_obj_open_addr $POOL_UUID file.h5 0x4000000000000003 +echo h5dsm_obj_open_addr $FILE 0x4000000000000003 +orterun -np 1 $EXEC_ARGS ./h5dsm_obj_open_addr $POOL_UUID $FILE 0x4000000000000003 if test $? -ne 0; then echo FAILED exit 1 fi -echo h5dsm_obj_open_addr file.h5 0x4000000000000003 \(2 processes\) -orterun -np 2 $EXEC_ARGS ./h5dsm_obj_open_addr $POOL_UUID file.h5 0x4000000000000003 +echo h5dsm_obj_open_addr $FILE 0x4000000000000003 \(2 processes\) +orterun -np 2 $EXEC_ARGS ./h5dsm_obj_open_addr $POOL_UUID $FILE 0x4000000000000003 if test $? -ne 0; then echo FAILED exit 1 @@ -482,16 +483,16 @@ fi # --------------- Snapshots --------------- # # H5Lexists before slink created (should be FALSE) -echo h5dsm_link_exists file.h5 grp2 7 -orterun -np 1 $EXEC_ARGS ./h5dsm_link_exists $POOL_UUID file.h5 slink 7 | tee -a h5dsm_test.out +echo h5dsm_link_exists $FILE grp2 7 +orterun -np 1 $EXEC_ARGS ./h5dsm_link_exists $POOL_UUID $FILE slink 7 | tee -a h5dsm_test.out if test $? -ne 0; then echo FAILED exit 1 fi # H5Lexists after slink created (should be TRUE) -echo h5dsm_link_exists file.h5 grp2 8 -orterun -np 1 $EXEC_ARGS ./h5dsm_link_exists $POOL_UUID file.h5 slink 8 | tee -a h5dsm_test.out +echo h5dsm_link_exists $FILE grp2 8 +orterun -np 1 $EXEC_ARGS ./h5dsm_link_exists $POOL_UUID $FILE slink 8 | tee -a h5dsm_test.out if test $? -ne 0; then echo FAILED exit 1 diff --git a/src/H5VLdaosm.c b/src/H5VLdaosm.c index 1f4b3f2..77d7c8b 100644 --- a/src/H5VLdaosm.c +++ b/src/H5VLdaosm.c @@ -161,6 +161,8 @@ static herr_t H5VL_daosm_attribute_read(void *_attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req); static herr_t H5VL_daosm_attribute_write(void *_attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL_daosm_attribute_get(void *_item, H5VL_attr_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_daosm_attribute_specific(void *_item, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); @@ -227,7 +229,7 @@ static H5VL_class_t H5VL_daosm_g = { H5VL_daosm_attribute_open, /* open */ H5VL_daosm_attribute_read, /* read */ H5VL_daosm_attribute_write, /* write */ - NULL,//H5VL_iod_attribute_get, /* get */ + H5VL_daosm_attribute_get, /* get */ H5VL_daosm_attribute_specific, /* specific */ NULL, /* optional */ H5VL_daosm_attribute_close /* close */ @@ -4492,50 +4494,53 @@ H5VL_daosm_dataset_get(void *_dset, H5VL_dataset_get_t get_type, { hid_t *plist_id = va_arg(arguments, hid_t *); - /* Retrieve the file's access property list */ + /* Retrieve the dataset's creation property list */ if((*plist_id = H5Pcopy(dset->dcpl_id)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get dset creation property list") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dset creation property list") break; - } + } /* end block */ case H5VL_DATASET_GET_DAPL: { hid_t *plist_id = va_arg(arguments, hid_t *); - /* Retrieve the file's access property list */ + /* Retrieve the dataset's access property list */ if((*plist_id = H5Pcopy(dset->dapl_id)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get dset access property list") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dset access property list") break; - } + } /* end block */ case H5VL_DATASET_GET_SPACE: { hid_t *ret_id = va_arg(arguments, hid_t *); + /* Retrieve the dataset's dataspace */ if((*ret_id = H5Scopy(dset->space_id)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get dataspace ID of dataset"); + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace ID of dataset"); break; - } + } /* end block */ case H5VL_DATASET_GET_SPACE_STATUS: { H5D_space_status_t *allocation = va_arg(arguments, H5D_space_status_t *); + /* Retrieve the dataset's space status */ *allocation = H5D_SPACE_STATUS_NOT_ALLOCATED; break; - } + } /* end block */ case H5VL_DATASET_GET_TYPE: { hid_t *ret_id = va_arg(arguments, hid_t *); + /* Retrieve the dataset's datatype */ if((*ret_id = H5Tcopy(dset->type_id)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype ID of dataset") break; - } + } /* end block */ case H5VL_DATASET_GET_STORAGE_SIZE: case H5VL_DATASET_GET_OFFSET: default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from dataset") - } + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "can't get this type of information from dataset") + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -5524,6 +5529,106 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL_daosm_attribute_get + * + * Purpose: Gets certain information about an attribute + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Neil Fortner + * May, 2017 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_daosm_attribute_get(void *_item, H5VL_attr_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + switch (get_type) { + /* H5Aget_space */ + case H5VL_ATTR_GET_SPACE: + { + hid_t *ret_id = va_arg(arguments, hid_t *); + H5VL_daosm_attr_t *attr = (H5VL_daosm_attr_t *)_item; + + /* Retrieve the attribute's dataspace */ + if((*ret_id = H5Scopy(attr->space_id)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get dataspace ID of dataset"); + break; + } /* end block */ + /* H5Aget_type */ + case H5VL_ATTR_GET_TYPE: + { + hid_t *ret_id = va_arg(arguments, hid_t *); + H5VL_daosm_attr_t *attr = (H5VL_daosm_attr_t *)_item; + + /* Retrieve the attribute's datatype */ + if((*ret_id = H5Tcopy(attr->type_id)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get datatype ID of dataset") + break; + } /* end block */ + /* H5Aget_create_plist */ + case H5VL_ATTR_GET_ACPL: + { + hid_t *ret_id = va_arg(arguments, hid_t *); + //H5VL_daosm_attr_t *attr = (H5VL_daosm_attr_t *)_item; + + /* Retrieve the file's access property list */ + if((*ret_id = H5Pcopy(H5P_ATTRIBUTE_CREATE_DEFAULT)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get attr creation property list"); + break; + } /* end block */ + /* H5Aget_name */ + case H5VL_ATTR_GET_NAME: + { + H5VL_loc_params_t loc_params = va_arg(arguments, H5VL_loc_params_t); + size_t buf_size = va_arg(arguments, size_t); + char *buf = va_arg(arguments, char *); + ssize_t *ret_val = va_arg(arguments, ssize_t *); + H5VL_daosm_attr_t *attr = (H5VL_daosm_attr_t *)_item; + + if(H5VL_OBJECT_BY_SELF == loc_params.type) { + size_t copy_len; + size_t nbytes; + + nbytes = HDstrlen(attr->name); + HDassert((ssize_t)nbytes >= 0); /*overflow, pretty unlikely --rpm*/ + + /* compute the string length which will fit into the user's buffer */ + copy_len = MIN(buf_size - 1, nbytes); + + /* Copy all/some of the name */ + if(buf && copy_len > 0) { + HDmemcpy(buf, attr->name, copy_len); + + /* Terminate the string */ + buf[copy_len]='\0'; + } /* end if */ + *ret_val = (ssize_t)nbytes; + } /* end if */ + else if(H5VL_OBJECT_BY_IDX == loc_params.type) { + HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "get attribute name by index unsupported"); + } /* end else */ + break; + } /* end block */ + /* H5Aget_info */ + case H5VL_ATTR_GET_INFO: + case H5VL_ATTR_GET_STORAGE_SIZE: + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "can't get this type of information from attr") + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_daosm_attribute_get() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_daosm_attribute_specific * * Purpose: Specific operations with attributes -- cgit v0.12